コード例 #1
0
ファイル: DatabaseSeeder.php プロジェクト: kasperbauer/kris
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();
        $faker = \Faker\Factory::create();
        $user = User::create(['name' => 'Christian Kasperbauer', 'email' => '*****@*****.**', 'password' => bcrypt('grütze'), 'phone' => '0176-23152819', 'misc' => 'Friedrich-Ebert-Ring 4
97072 Würzburg
(Ton-)Technik, KRIS, Website!', 'rights' => 'all']);
        $user2 = User::create(['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt('grütze'), 'phone' => $faker->phoneNumber, 'misc' => $faker->sentence()]);
        for ($i = 0; $i <= 15; $i++) {
            User::create(['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt('grütze'), 'phone' => $faker->phoneNumber, 'misc' => $faker->sentence()]);
        }
        Category::insert([['name' => 'Konzert', 'class' => 'light-green'], ['name' => 'Partey', 'class' => 'funky'], ['name' => 'Theater', 'class' => 'red'], ['name' => 'Kino', 'class' => 'amber'], ['name' => 'Sonstiges', 'class' => 'blue-grey'], ['name' => 'Wort', 'class' => 'light-blue']]);
        $user->events()->save(Event::create(['scheduled_at' => Carbon::now()->addDays(4), 'category_id' => rand(1, 6), 'title' => 'Basement Blast', 'subtitle' => 'Geballer im Keller', 'description' => $faker->paragraph(10), 'admission' => 'donation', 'genre' => 'Metal', 'google_event_id' => str_random(12)]));
        $user2->events()->save(Event::create(['scheduled_at' => Carbon::now()->addDays(9), 'category_id' => rand(1, 6), 'title' => 'Boxbeutel Boombox', 'subtitle' => 'Lecker Weinchen', 'description' => $faker->paragraph(10), 'admission' => 'free', 'genre' => 'Suff', 'google_event_id' => str_random(12)]));
        $user->events()->save(Event::create(['scheduled_at' => Carbon::now()->addDays(2)->addMonth(), 'category_id' => rand(1, 6), 'title' => 'Beats & Lyrics', 'subtitle' => 'Freestyle Chypher', 'description' => $faker->paragraph(10), 'admission' => 'donation', 'genre' => 'HipHop', 'google_event_id' => str_random(12)]));
        $user2->events()->save(Event::create(['scheduled_at' => Carbon::now()->subDays(2), 'category_id' => rand(1, 6), 'title' => 'Schon vorbei', 'subtitle' => 'Schade, du warst du spät', 'description' => $faker->paragraph(10), 'admission' => 'free', 'google_event_id' => str_random(12)]));
        $user->events()->save(Event::create(['scheduled_at' => Carbon::now()->subMonth(2), 'category_id' => rand(1, 6), 'title' => 'Gelöscht', 'subtitle' => 'Wird niemals stattfinden', 'description' => $faker->paragraph(10), 'admission' => 'free', 'google_event_id' => str_random(12), 'deleted_at' => Carbon::now()->subDays(7)]));
        $events = Event::all();
        foreach ($events as $event) {
            $event->options()->save(EventOptions::create(['time_start' => '19:00', 'time_end' => '00:00', 'time_meal' => '18:00', 'shifts_bar' => rand(1, 2), 'shifts_tech' => rand(0, 2), 'shifts_door' => rand(0, 1), 'meal_servings' => rand(0, 15), 'misc' => 'Test test test']));
            $user_id = rand(1, 2);
            $event->shifts()->save(Shift::create(['user_id' => $user_id, 'type' => 'tech']));
            $event->shifts()->save(Shift::create(['user_id' => $user_id == 1 ? 2 : 1, 'type' => 'bar']));
        }
        Model::reguard();
    }
コード例 #2
0
ファイル: EventsController.php プロジェクト: kasperbauer/kris
 public function store(EventRequest $request)
 {
     $event = Event::create($request->all());
     $event->options()->save(EventOptions::create());
     $event->mockGoogleEventId();
     // todo: use google calendar api
     Auth::user()->events()->save($event);
     return $this->respond($event);
 }