/** * Bootstrap the application services. * * @return void */ public function boot() { view()->composer('app.partials.navLists', function ($view) { return $view->with('userLists', \App\ListModel::where('user_id', \Auth::user()->id)->get()); }); view()->composer('app.partials.nav', function ($view) { return $view->with('user', Auth::user()); }); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $list = \App\ListModel::find($id); if (Auth::user()->id == $list->user_id) { $list->destroy($id); return redirect('/list'); } return redirect('/list')->withErrors('You do not have permission to delete that list.'); }