Example #1
0
 public function run()
 {
     // $faker = Faker\Factory::create();
     $files = ['supercar-wallpapers-audi-r8-2.jpg', 'supercar-wallpapers-audi-r8-3.jpg', 'supercar-wallpapers-audi-r8-4.jpg', 'supercar-wallpapers-bugatti-4.jpg', 'supercar-wallpapers-mercedes-sls-amg-1.jpg'];
     $sizes = [620522, 963430, 219634, 424972, 322458];
     for ($i = 1; $i <= 40; $i++) {
         $max_times = rand(3, count($files));
         $meetup = Meetup::find($i);
         $poster_id = $meetup->poster_id;
         for ($j = 0; $j < $max_times; $j++) {
             factory(App\Entities\Photo::class)->create(['user_id' => $poster_id, 'title' => 'yada yada yada', 'imageable_id' => $i, 'imageable_type' => 'App\\Entities\\Meetup', 'image_file_name' => $files[$j], 'image_file_size' => $sizes[$j]]);
         }
         $meetup->photos = $max_times;
         $meetup->save();
     }
 }
Example #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     User::truncate();
     Profile::truncate();
     Language::truncate();
     Expertise::truncate();
     Meetup::truncate();
     Photo::truncate();
     Model::unguard();
     $this->call('UsersTableSeeder');
     $this->call('ProfilesTableSeeder');
     $this->call('LanguagesTableSeeder');
     $this->call('ExpertisesTableSeeder');
     $this->call('MeetupsTableSeeder');
     $this->call('PhotosTableSeeder');
     Model::reguard();
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
Example #3
0
 public function putPrivateImage(Request $request)
 {
     $meetup_id = $request->session()->get('meetup_id');
     $meetup = Meetup::findOrFail($meetup_id);
     $count = $meetup->photos()->count();
     $meetup->photos = $count;
     $meetup->save();
     return redirect('meetups/create/private/post')->with('count', $count);
 }