/
home
/
sditechnicalteam
/
public_html
/
app
/
Observers
/
File Upload :
llllll
Current File: /home/sditechnicalteam/public_html/app/Observers/TaskLabelListObserver.php
<?php namespace App\Observers; use App\Models\Task; use App\Models\TaskLabelList; class TaskLabelListObserver { public function creating(TaskLabelList $model) { if(company()) { $model->company_id = company()->id; } } public function updated($taskLabel) { if ($taskLabel->isDirty('project_id') && request()->task_id != null) { $task = Task::with('labels')->findOrFail(request()->task_id); if ($task->project_id != $taskLabel->project_id) { $task->labels()->detach(request()->label_id); } } } }
Copyright ©2k19 -
Hexid
|
Tex7ure