/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('club_posts')->delete();
     $bde_id = DB::table('clubs')->where('slug', 'bde')->value('id');
     ClubPost::create(['club_id' => $bde_id, 'title' => 'Lorem Ipsum Sin Dolores Amet', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'author' => 'rapasti']);
     ClubPost::create(['club_id' => $bde_id, 'title' => 'Coucou ceci est un titre de test', 'content' => 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', 'author' => 'gerard']);
 }
 protected function home()
 {
     $bigevent = [];
     $settings = Setting::all();
     foreach ($settings as $setting) {
         $arr = ['name' => $setting['name'], 'value' => $setting['value']];
         if (substr($setting['key'], 0, 3) === "be-") {
             $bigevent[$setting['key']] = $arr;
         } else {
             $other[$setting['key']] = $arr;
         }
     }
     //BEAUCOUPS D'APPELS A LA BDD, CERTES EN HAUT C'EST PAS FORCEMENT MIEUX, de tout facon faudra faire un systeme de "event mis en avant" en faisant les events.
     /*
     	$about = Setting::where('key', 'about')->first();
     	$bigevent["main-photo"] = Setting::where('key', 'be-main-photo')->first()->value;
     	$bigevent["bg-photo"] = Setting::where('key', 'be-bg-photo')->first()->value;
     	$bigevent["title"] = Setting::where('key', 'be-title')->first()->value;
     	$bigevent["label"] = Setting::where('key', 'be-label')->first()->value;
     	$bigevent["description"] = Setting::where('key', 'be-description')->first()->value;
     	$bigevent["link"] = Setting::where('key', 'be-link')->first()->value;
     	$agenda = Setting::where('key', 'agenda')->first()->value;
     	$posts = ClubPost::all();
     	return view('home')->with([
     		'about' => $about->value,
     		'posts' => $posts,
     		'bigevent' => $bigevent,
     		'agenda' => $agenda]);
     */
     $posts = ClubPost::all();
     return view('home')->with(['posts' => $posts, 'bigevent' => $bigevent, 'other' => $other]);
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $club = getClub($id, 'admin::clubs');
     ClubPost::where('club_id', $club->id)->delete();
     Club::destroy($club->id);
     return Redirect::route('admin::clubs')->with('success', 'The club has been deleted');
 }