Created
April 25, 2020 18:17
-
-
Save jongravois/62fce02d21cdd44542381cc2c9b838d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Livewire\Tasks; | |
use App\Models\UserTask; | |
use App\Models\UserTaskGroup; | |
use Livewire\Component; | |
class TaskBar extends Component | |
{ | |
public $task; | |
public $expanded = false; | |
public function mount($task) | |
{ | |
$this->task = $task->toArray(); | |
} // end function | |
public function render() | |
{ | |
return view('livewire.tasks.task-bar', [ | |
'groups' => UserTaskGroup::whereUserId(auth()->id())->get() | |
]); | |
} // end function | |
public function addToGroup() | |
{ | |
dd($this->task['group_id']); | |
} // end function | |
public function deleteTask($id) | |
{ | |
$task = UserTask::whereId($id)->delete(); | |
$this->emit('taskDeleted'); | |
} // end function | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment