/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index($listId) { $list = $this->list->with('todos.responsible')->find($listId); if (Gate::denies('manage-todo', $list)) { abort(403, 'You dont have permissions to do that!!'); } return $list->todos; }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $list = $this->list->with(['todos', 'collaborators'])->find($id); if (Gate::denies('manage-todo', $list)) { abort(403, 'You dont have permissions!!'); } return $list; }