コード例 #1
0
 public function albums()
 {
     $albums = Albums::where('parent', '0')->get();
     foreach ($albums as $parent) {
         foreach ($parent->childrens as $babies) {
             $picture = $babies->photos->random(1);
             $parent->randomPicture = $picture;
         }
     }
     return view('page/albums', ["albums" => $albums]);
 }
コード例 #2
0
 /**
  * Permet d'aficher la page d'ajout de photo
  *
  * @param  int  $id
  * @return View
  */
 public function photosAddView($id)
 {
     $album = Albums::find($id);
     return view('albums.photos', compact('album'));
 }
コード例 #3
0
ファイル: DatabaseSeeder.php プロジェクト: ahmeali/talk
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('Albums')->delete();
     \App\Albums::create(['name' => 'All', "id" => 1]);
 }
コード例 #4
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $album = Albums::where('slug', $id)->first();
     return view('albums.show', ['album' => $album]);
 }