Skip to content

Instantly share code, notes, and snippets.

@jongravois
Created April 25, 2020 18:17
Show Gist options
  • Save jongravois/62fce02d21cdd44542381cc2c9b838d2 to your computer and use it in GitHub Desktop.
Save jongravois/62fce02d21cdd44542381cc2c9b838d2 to your computer and use it in GitHub Desktop.
<?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