On laravel 11 site User model has pivot reference to tasks table
public function uncompletedTasks(): belongsToMany {
return $this->belongsToMany(Task::class)
->using(TaskUser::class)
->withPivot('supervisor_id') // Reference to "task_user" table
->where('completed',false)
->orderBy('priority', 'desc')
->orderBy('deadline_at', 'desc');
}
and I need having $taskId to check if it exists in read data, something like :
$uncompletedTasks = LoggedUserFacade::getLoggedUser()->uncompletedTasks()->get()->findOrFail($taskId);
as in request above method findOrFail does not exists!
I searched in helpers at https://laravel.com/docs/11.x/helpers, but I did not find any decision…
Sure I know how to check it in foreach block, but maybe some better decision ?
Are there any ?
"laravel/framework": "^11.10.0",
Thanks in advance!