Files
a.montask/app/Models/Tasks.php
T
2026-04-08 07:22:13 +00:00

66 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Console\View\Components\Task;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
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',
'parent',
];
public function users()
{
// return $this->belongsToMany(User::class, 'pivot_tasks', 'task_id', 'user_id');
return $this->belongsToMany(
User::class,
'pivot_tasks',
'task_id',
'user_id',
'task_id',
'plain_id',
);
}
public function pivotTask()
{
return DB::table('pivot_tasks')
->where('task_id', $this->task_id);
}
}