Files
a.montask/app/Models/Tasks.php
T

66 lines
1.3 KiB
PHP
Raw Normal View History

2025-10-11 13:38:30 +00:00
<?php
namespace App\Models;
2026-04-08 07:22:13 +00:00
use Illuminate\Console\View\Components\Task;
2025-10-11 13:38:30 +00:00
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
2026-04-08 07:22:13 +00:00
use Illuminate\Support\Facades\DB;
2025-10-11 13:38:30 +00:00
class Tasks extends Model
{
use HasFactory;
protected $table = 'tasks';
// protected $primaryKey = 'id'; // چون جدول UUID داره
// public $incrementing = false;
// protected $keyType = 'int';
protected $fillable = [
'task_id',
'name',
'description',
'workspace_slug',
'assignees',
'start_date',
'target_date',
'priority',
'description_html',
'completed_at',
'project',
'workspace',
'state',
'json',
'created_at',
'updated_at',
'deleted_at',
'created_by',
'updated_by',
'deleted_by',
2026-04-08 07:22:13 +00:00
'parent',
2025-10-11 13:38:30 +00:00
];
public function users()
{
// return $this->belongsToMany(User::class, 'pivot_tasks', 'task_id', 'user_id');
return $this->belongsToMany(
2026-04-08 07:22:13 +00:00
User::class,
'pivot_tasks',
'task_id',
'user_id',
'task_id',
'plain_id',
2025-10-11 13:38:30 +00:00
);
}
2026-04-08 07:22:13 +00:00
public function pivotTask()
{
return DB::table('pivot_tasks')
->where('task_id', $this->task_id);
}
2025-10-11 13:38:30 +00:00
}