public function getTaskEvent($te) { $task_files = TaskFile::selectRaw('taskfiles.*, users.username')->join('users', 'taskfiles.users_id', '=', 'users.id')->where('taskevents_id', $te->id)->get(); $resp[] = ['info' => $te, 'files' => $task_files]; return Response::json((object) $resp); }
public function getTasks($model) { /* Get tasks asociated with a given event */ $event_tasks = TaskEvent::where('events_id', $model->id)->get(); $resp = []; foreach ($event_tasks as $event_task_ndx => $curr_task) { $task_files = TaskFile::selectRaw('taskfiles.*, users.username')->join('users', 'taskfiles.users_id', '=', 'users.id')->where('taskevents_id', $curr_task->id)->get(); $resp[] = ['info' => $curr_task, 'files' => $task_files]; } return $resp; }