Un-butcher task system.
This commit is contained in:
parent
0fe9a4566e
commit
7f1a97184b
12 changed files with 154 additions and 77 deletions
|
@ -320,7 +320,7 @@ class Server extends Model
|
|||
*/
|
||||
public function tasks()
|
||||
{
|
||||
return $this->hasMany(Task::class, 'server', 'id');
|
||||
return $this->hasMany(Task::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,8 +49,10 @@ class Task extends Model
|
|||
*/
|
||||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'server' => 'integer',
|
||||
'queued' => 'integer',
|
||||
'user_id' => 'integer',
|
||||
'server_id' => 'integer',
|
||||
'queued' => 'boolean',
|
||||
'active' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -59,4 +61,24 @@ class Task extends Model
|
|||
* @var array
|
||||
*/
|
||||
protected $dates = ['last_run', 'next_run', 'created_at', 'updated_at'];
|
||||
|
||||
/**
|
||||
* Gets the server associated with a task.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function server()
|
||||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user associated with a task.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue