Looking for best practices, given these 3 tables:
Task (id, title, description) User (id, name) User_task (user_id, task_id)
My class/Object User has a function addToCompletedTasks(Task task) to add a task to his list of completed task (that adds the task into the table User_task).
I'm looking for best practice to send my completed task FROM my view TO my controller. Right now I'm sending an ID but I'm wondering if it's possible to send the object so I don't have to instantiate the task in my controller to add it to the completedtasks list.
public function insertCompletedTask(Request $request)
{
$task_id = $request->input('task_id');
$user = \Auth::user();
$task = Task::whereId($task_id)->first();
$update = $user->assignCompletedTask($task);
}