54 lines
1011 B
PHP
54 lines
1011 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class MobileTask extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'mobile_tasks';
|
|
|
|
protected $fillable = [
|
|
'title',
|
|
'description',
|
|
'status',
|
|
'priority',
|
|
'due_date',
|
|
'assignee_id',
|
|
'project_id',
|
|
'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'due_date' => 'date',
|
|
];
|
|
|
|
public function assignee()
|
|
{
|
|
return $this->belongsTo(User::class, 'assignee_id');
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function project()
|
|
{
|
|
return $this->belongsTo(Project::class, 'project_id');
|
|
}
|
|
|
|
public function subtasks()
|
|
{
|
|
return $this->hasMany(MobileSubtask::class, 'task_id');
|
|
}
|
|
|
|
public function pins()
|
|
{
|
|
return $this->hasMany(MobileTaskPin::class, 'task_id');
|
|
}
|
|
}
|