/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { if (Auth::check()) { $actu = Actualite::orderBy('id', 'desc')->first(); $topics = Topic::with('posts')->orderBy('created_at', 'desc')->take(5)->get(); //$postPerTopic = $userLevel = $this::checkLevel(); return view('index', ['topics' => $topics, 'actu' => $actu, 'level' => $userLevel]); } else { return view('index'); } }
/** * Display the resource. * * @return \Illuminate\Http\Response */ public function show($slug) { $news = Actualite::where('slug', $slug)->firstOrFail(); return view('news.show', ['news' => $news]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $news = Actualite::findOrFail($id); $news->delete(); Session::flash('flash_message', 'News successfully deleted!'); return redirect()->route('administration.news.index'); }