Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     for ($i = 1; $i < 40; $i++) {
         Event::create(['title' => 'title', 'body' => 'event' . $i, 'time' => date("Y/m/d"), 'location' => 'zhejiang']);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request, Studio $studio)
 {
     $event = Event::create($this->prepare($request, $studio));
     $event->pieces()->sync($this->prepareTags($request));
     $event->categories()->sync($this->prepareTags($request, 'category_list'));
     return redirect()->action('Admin\\StudioEventsController@show', [$studio->id, $event->id]);
 }
Ejemplo n.º 3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     if (Auth::check()) {
         # code...
         if (Auth::user()->type == 1) {
             # code...
             $rules = ['activity_id' => 'required|integer', 'event_name' => 'required|unique:events', 'image_path' => 'required|image'];
             $validator = Validator::make($request->all(), $rules);
             if ($validator->fails()) {
                 # code...
                 return redirect()->back()->withErrors($validator);
             }
             if ($request->hasFile('image_path')) {
                 $input = $request->all();
                 $image = $input['image_path'];
                 $name = '' . $input['event_name'] . '.png';
                 //dd($name);
                 $image = $image->move(public_path() . '/images/events/', studly_case($name));
                 $url = '/images/events/' . studly_case($name);
                 $event = Event::create(['activity_id' => $input['activity_id'], 'event_name' => $input['event_name'], 'image_path' => $url]);
                 if ($event) {
                     # code...
                     $subscribedUsers = $this->getUsers($event->activity_id);
                     $this->sendEmail($subscribedUsers, $event->event_name);
                     Session::flash('eventCreated', $event->event_name . ' has been created!');
                 } else {
                     return "error creating the event.";
                 }
                 return redirect('home');
             }
             return redirect('/');
         }
     }
     return redirect('/');
 }
Ejemplo n.º 4
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $user = Auth::user();
     $group = $user->group;
     $event = Event::create(['group_id' => $group->id, 'date' => $request->date, 'male_name' => $request->male_name, 'female_name' => $request->female_name, 'guests_count' => $request->guests_count, 'place' => $request->place]);
     return redirect(url('/'));
 }
Ejemplo n.º 5
0
 public function create(array $data)
 {
     $event_time = $this->dateToTime($data['event_time']);
     $start_at = $event_time['start_time'];
     $end_at = $event_time['end_time'];
     return Event::create(['title' => $data['title'], 'planner' => $data['planner'], 'description' => $data['description'], 'start_at' => $start_at, 'end_at' => $end_at]);
 }
Ejemplo n.º 6
0
    /**
     * 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();
    }
Ejemplo n.º 7
0
 public function startup()
 {
     $this->user = User::create(array('firstname' => 'Simon', 'email' => '*****@*****.**'));
     $this->event = Event::create(array('name' => 'The Red Wedding', 'uid' => $this->user->uid, 'location' => 'Winnipeg'));
     $this->poll = Poll::create(array('eid' => $this->event->eid, 'polltype' => 'test_type'));
     $this->lastPollOption = PollOption::max('oid');
 }
Ejemplo n.º 8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //user:1
     //one day: 2
     //long events:3
     Event::create(array('name' => 'test1', 'user_id' => 1, 'calendar_id' => 2, 'startDate' => '2016-05-09 17:19:00', 'endDate' => '2016-05-09 20:52:00', 'length_hours' => 4, 'length_days' => 0, 'allDay' => false, 'repeats' => false));
     Event::create(array('name' => 'test2', 'user_id' => 1, 'calendar_id' => 2, 'startDate' => '2016-05-09 14:50:00', 'endDate' => '2016-05-09 21:10:00', 'length_hours' => 7, 'length_days' => 0, 'allDay' => false, 'repeats' => false));
     Event::create(array('name' => 'test3', 'user_id' => 1, 'calendar_id' => 2, 'startDate' => '2016-05-11 21:56:00', 'endDate' => '2016-05-12 00:00:00', 'length_hours' => 3, 'length_days' => 0, 'allDay' => false, 'repeats' => false));
     Event::create(array('name' => 'test4', 'user_id' => 1, 'calendar_id' => 2, 'startDate' => '2016-05-18 00:00:00', 'endDate' => '2016-05-19 00:00:00', 'length_hours' => 24, 'length_days' => 0, 'allDay' => false, 'repeats' => false));
     Event::create(array('name' => 'test5', 'user_id' => 1, 'calendar_id' => 2, 'startDate' => '2016-05-23 00:00:00', 'endDate' => '2016-05-23 19:45:00', 'length_hours' => 20, 'length_days' => 0, 'allDay' => false, 'repeats' => false));
     Event::create(array('name' => 'test6', 'user_id' => 1, 'calendar_id' => 1, 'startDate' => '2016-05-18 18:56:00', 'endDate' => '2016-05-19 04:20:00', 'length_hours' => 10, 'length_days' => 2, 'allDay' => false, 'repeats' => false));
     //*****Long Events***********
     Event::create(array('name' => 'test7', 'user_id' => 1, 'calendar_id' => 3, 'startDate' => '2016-05-02 19:14:00', 'endDate' => '2016-05-04 22:57:00', 'length_hours' => 51.72, 'length_days' => 3, 'allDay' => false, 'repeats' => false));
     Event::create(array('name' => 'test8', 'user_id' => 1, 'calendar_id' => 3, 'startDate' => '2016-05-12 21:36:00', 'endDate' => '2016-05-16 00:00:00', 'length_hours' => 75, 'length_days' => 4, 'allDay' => false, 'repeats' => false));
     Event::create(array('name' => 'test9', 'user_id' => 1, 'calendar_id' => 3, 'startDate' => '2016-05-11 00:00:00', 'endDate' => '2016-05-16 00:00:00', 'length_hours' => 120, 'length_days' => 5, 'allDay' => false, 'repeats' => false));
     Event::create(array('name' => 'test10', 'user_id' => 1, 'calendar_id' => 3, 'startDate' => '2016-05-20 00:00:00', 'endDate' => '2016-05-23 22:52:00', 'length_hours' => 95, 'length_days' => 4, 'allDay' => false, 'repeats' => false));
     //*****************repetitions*************************************
     //single reps calendar:4
     //long reps calendar:5
     Event::create(array('name' => 'rep1', 'user_id' => 1, 'calendar_id' => 4, 'startDate' => '2016-05-30 13:07:00 ', 'endDate' => ' 2016-05-30 23:39:00', 'length_hours' => 10.53, 'length_days' => 0, 'allDay' => false, 'repeats' => 1));
     Event::create(array('name' => 'rep11', 'user_id' => 1, 'calendar_id' => 5, 'startDate' => '2016-08-09 13:13:00', 'endDate' => '2016-08-13 00:00:00', 'length_hours' => 83, 'length_days' => 4, 'allDay' => false, 'repeats' => 1));
     Event::create(array('name' => 'rep13', 'user_id' => 1, 'calendar_id' => 5, 'startDate' => '2016-05-16 00:00:00', 'endDate' => '2016-05-18 16:18:00', 'length_hours' => 65, 'length_days' => 3, 'allDay' => false, 'repeats' => 1));
     Event::create(array('name' => 'montly1', 'user_id' => 1, 'calendar_id' => 6, 'startDate' => '2016-05-03 00:00:00', 'endDate' => '2016-05-03 15:19:00', 'length_hours' => 16, 'length_days' => 0, 'allDay' => false, 'repeats' => 1));
     Event::create(array('name' => 'year1', 'user_id' => 1, 'calendar_id' => 1, 'startDate' => '2016-05-03 00:00:00', 'endDate' => '2016-05-03 15:13:00', 'length_hours' => 15.22, 'length_days' => 0, 'allDay' => false, 'repeats' => 1));
     Event::create(array('name' => 'montly long', 'user_id' => 1, 'calendar_id' => 6, 'startDate' => "2016-05-10 00:00:00", 'endDate' => '2016-05-13 00:00:00', 'length_hours' => 72, 'length_days' => 3, 'allDay' => false, 'repeats' => 1));
     Event::create(array('name' => 'year long', 'user_id' => 1, 'calendar_id' => 5, 'startDate' => '2016-05-10 14:00:00', 'endDate' => '2016-05-13 00:00:00', 'length_hours' => 58, 'length_days' => 3, 'allDay' => false, 'repeats' => 1));
 }
Ejemplo n.º 9
0
 public function testEventDelete()
 {
     $this->startUp();
     $event = Event::create(array('name' => 'The Red Wedding', 'uid' => $this->user->uid, 'location' => 'Winnipeg'));
     $event->delete();
     $this->notSeeInDatabase('events', array('name' => 'TheRedWedding'));
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     User::create(['first_name' => 'null', 'last_name' => 'null', 'email' => 'null@null']);
     Event::create(['name' => 'null', 'user_id' => 1, 'slug' => 'null', 'private' => 1, 'active' => 0]);
     $styles = ['Rock', 'Hard Rock', 'Métal', 'Techno', 'House', 'Futur House', 'Rap', 'R&B', 'Pop', 'Pop Rock', 'Jazz', 'Blues'];
     $this->createStyles($styles);
 }
Ejemplo n.º 11
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateEventRequest $req)
 {
     $input = $req->all();
     // Makes sure chair_id enters database as an integer or null if left empty.
     strcmp($input['chair_id'], "") == 0 ? $input['chair_id'] = null : ($input['chair_id'] = (int) $input['chair_id']);
     // Ensures database times are always in UTC.
     foreach ($input as $key => $value) {
         // Ensures only time fields are changed.
         if (!strpos($key, 'time')) {
             continue;
         }
         // Converts time from PST to UTC.
         $pst = new Carbon($value, 'America/Los_Angeles');
         $utc = $pst->setTimezone('UTC');
         // Sets date/time string back into values for database.
         $input[$key] = $utc->toDateTimeString();
     }
     $input['creator_id'] = \Auth::id();
     // Set creator ID by default
     // Set default close time if needed
     if (!isset($input['close_time'])) {
         $input['close_time'] = $input['start_time'];
     }
     // Set default open time if needed
     if (!isset($input['open_time'])) {
         $input['open_time'] = Carbon::now();
     }
     // Create event
     $event = Event::create($input);
     return redirect()->action('EventsController@show', $event->slug);
 }
Ejemplo n.º 12
0
 public function create(Request $request)
 {
     if ($request->isMethod('get')) {
         $this->data['items'] = Event::orderBy('created_at', 'desc')->get();
         $this->data['questions'] = Question::get();
         // return var_dump($this->data['questions']);
         return view('pages.event.create', $this->data);
     } elseif ($request->isMethod('post')) {
         $data = $request->all();
         $event = Event::create($request->all());
         $user = User::where('positionid', 1)->get();
         foreach ($user as $lala) {
             $item = new Score();
             $item->eventid = $event->id;
             $item->score = 0;
             $item->userid = $lala->id;
             $item->save();
         }
         if ($event) {
             if (array_key_exists('questions', $data)) {
                 $event->question()->sync($data['questions']);
                 $event->update(['enabled' => 1]);
             }
             return redirect('event');
         } else {
             return redirect('event');
         }
     }
 }
Ejemplo n.º 13
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('events')->truncate();
     Event::create(['tablename' => 'users', 'action' => 'create(创建)', 'user_id' => 2]);
     Event::create(['tablename' => 'users', 'action' => 'store(保存)', 'user_id' => 2]);
     Event::create(['tablename' => 'users', 'action' => 'destroy(删除)', 'user_id' => 2]);
 }
Ejemplo n.º 14
0
 /**
  * Store a newly created event in the events table.
  *
  * @param  \Illuminate\Http\Request  $input
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $messages = ['date_format' => 'The start time does not match the format HH:MM:SS'];
     //Validates the input from the create event page
     $this->validate($request, ['name' => 'required|max:40', 'venue' => 'required|max:30', 'city' => 'required|max:30', 'price' => 'required|numeric', 'information' => 'required|max:255', 'description' => 'required', 'capacity' => 'required|numeric', 'date' => 'required|date', 'start_time' => 'required|date_format:H:i:s', 'end_time' => 'required|date_format:H:i:s', 'image' => 'image|required'], $messages);
     //adds all the data from the create events page to the database in the events table
     $name = $request->input('name');
     $venue = $request->input('venue');
     $city = $request->input('city');
     $price = $request->input('price');
     $information = $request->input('information');
     $description = $request->input('description');
     $capacity = $request->input('capacity');
     $date = $request->input('date');
     $start_time = $date . ' ' . $request->input('start_time');
     $end_time = $date . ' ' . $request->input('end_time');
     $image = 'image';
     echo $end_time;
     Event::create(['name' => $name, 'venue' => $venue, 'city' => $city, 'price' => $price, 'information' => $information, 'description' => $description, 'capacity' => $capacity, 'date' => $start_time, 'end_time' => $end_time, 'image' => $image]);
     //gets the id of the event above and concats it to the file extension of the image uploaded.
     $name = Event::latest()->first()->id . "." . Input::file('image')->getClientOriginalExtension();
     //gets the event ID and concat on the imaage file extension that was uploaded
     //moves and renames the image selected from a temp directory to the event_images folder as
     Input::file('image')->move(public_path() . '/img/event_images', $name);
     //moves the uploaded image from the tmp directory to a premanant one (/public/img/event_images) and renames it to <eventID>.<fileExt>
     $image = Event::latest()->first();
     //returns the latest event added to the table (the one just added above)
     $image->image = $name;
     //adds the image name from above to the image column of the latest event
     $image->save();
     //saves the above action
     return redirect('events');
     //redirects to events view when finished
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $u = User::create(['first_name' => 'test', 'last_name' => 'test', 'email' => '*****@*****.**', 'level' => 1]);
     $u2 = User::create(['first_name' => 'test2', 'last_name' => 'test2', 'email' => '*****@*****.**', 'level' => 1]);
     $u3 = User::create(['first_name' => 'test3', 'last_name' => 'test3', 'email' => '*****@*****.**', 'level' => 2]);
     $e1 = Event::create(['name' => 'test event', 'user_id' => 3, 'slug' => 'test-event-1', 'date' => '2016-10-17', 'start' => '18:00:00', 'end' => '5:00:00']);
     $e2 = Event::create(['name' => 'test event', 'user_id' => 1, 'slug' => 'test-event-2', 'date' => '2016-08-22', 'start' => '19:00:00', 'end' => '5:00:00']);
     Event::create(['name' => 'test event', 'user_id' => 2, 'slug' => 'test-event-3', 'date' => '2017-01-07', 'start' => '18:00:00', 'end' => '5:00:00']);
     $p1 = Playlist::create(['name' => 'Playlist principale !']);
     $p2 = Playlist::create(['name' => 'The Playlist !']);
     $p3 = Playlist::create(['name' => 'Playlist secondaire']);
     Playlist::create(['name' => 'The Playlist !']);
     $p1->styles()->sync([1, 2, 3]);
     $p2->styles()->sync([1, 4]);
     $p3->styles()->sync([1, 3, 5, 7]);
     $e1->playlists()->sync([1, 3]);
     $e2->playlists()->sync([2]);
     Comment::create(['event_id' => 2, 'user_id' => 2, 'content' => 'Sooo goooood']);
     Comment::create(['event_id' => 3, 'user_id' => 2, 'content' => 'Sooo goooood :D']);
     Comment::create(['event_id' => 2, 'user_id' => 3, 'content' => 'Sooo goooood !!!']);
     Video::create(['url' => '7l48bfQuJeE', 'artist' => 'Chill Bump', 'name' => 'Lost In The Sound', 'tags' => 'chill bump lost in the sound']);
     Video::create(['url' => 'XxdPJvhQaMU', 'artist' => 'Chill Bump', 'name' => 'Water boycotter', 'tags' => 'chill bump water boycotter']);
     Video::create(['url' => 'kWXAYDQ_K7k', 'artist' => 'Chill Bump', 'name' => 'The Memo', 'tags' => 'chill bump the memo']);
     $pivot1 = $p1->videos()->sync([1, 3]);
     $pivot2 = $p2->videos()->sync([2]);
     $pivot3 = $p3->videos()->sync([1, 2, 3]);
     News::create(['title' => 'news 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. ', 'user_id' => 2, 'slug' => 'text-news-1']);
     News::create(['title' => 'news test 2', '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. ', 'user_id' => 3, 'slug' => 'text-news-2']);
     Article::create(['title' => 'Article test 1', '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. ', 'user_id' => 2, 'slug' => 'text-article-1']);
     Article::create(['title' => 'Article test 2', '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. ', 'user_id' => 3, 'slug' => 'text-article-2', 'event_id' => 2]);
 }
Ejemplo n.º 16
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(EventRequest $request)
 {
     $input = Input::all();
     $slug = strtolower(implode('-', explode(' ', $input['title'])));
     $slug = str_replace('?', '', $slug);
     $slug = str_replace('/', '', $slug);
     $slug = str_replace('\\', '', $slug);
     if (Event::where('slug', $slug)->first()) {
         return Response::json([0 => 'Dit Evenement is al aangemaakt.'], 409);
     }
     $input['content'] = str_replace("\n", '', $input['content']);
     // remove line endings
     $input['content'] = str_replace("\r", '', $input['content']);
     // remove line endings
     $input['slug'] = $slug;
     $event = Event::create($input);
     if (Auth::user()->hasOnePrivelege(['Moderator', 'Administrator'])) {
         $event->state = Input::get('publish') == "true" ? 0 : 1;
     } else {
         $event->state = 1;
     }
     $tags = explode(',', $input['tags']);
     foreach ($tags as $tag) {
         $event->tag($tag);
     }
     return [0 => 'Evenement aangemaakt, klik <a href="/events/' . $slug . '">hier</a> om het te bekijken.'];
 }
Ejemplo n.º 17
0
 public function store(Request $request)
 {
     $this->validate($request, ['from_time' => 'required', 'to_time' => 'required']);
     Event::create(['name' => 'settle', 'from_time' => $request->input('from_time'), 'to_time' => $request->input('to_time')]);
     Flash::success(trans('admin\\messages.settleCreated'));
     return redirect(route('admin.settle.index'));
 }
Ejemplo n.º 18
0
 /**
  * Save a new event
  *
  * @return redirect
  **/
 public function save(CreateEventRequest $request)
 {
     $event = Event::create($request->except(['_token', 'players']));
     foreach ($request->players as $playerId) {
         $event->players()->save(Player::find($playerId));
     }
     return redirect()->route('dashboard.events.single', $event->id)->with('app-success', 'Your event has been created.');
 }
Ejemplo n.º 19
0
 public function run()
 {
     DB::table('events')->delete();
     $wtc2016 = Event::create(['name' => 'wtc-2016', 'description' => '2016 World Team Championship', 'start_timestamp' => Carbon::createFromTimestamp(Carbon::create(2016, 9, 24, 9, 30, 0)->timestamp), 'end_timestamp' => Carbon::createFromTimestamp(Carbon::create(2016, 9, 25, 18, 30, 0)->timestamp)]);
     $depositDeadline = Deadline::create(['event_id' => $wtc2016->id, 'description' => 'Team deposit (100€)', 'type' => 'payment', 'due_timestamp' => Carbon::createFromTimestamp(Carbon::create(2016, 4, 1, 23, 59, 59)->timestamp)]);
     $admin = User::all()->where('name', 'admin')->first();
     UserDeadline::create(['user_id' => $admin->id, 'deadline_id' => $depositDeadline->id, 'completed' => false]);
 }
Ejemplo n.º 20
0
 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);
 }
Ejemplo n.º 21
0
 public function run($inputs)
 {
     $translations = $inputs['translations'];
     DB::beginTransaction();
     $event = Event::create($inputs);
     foreach ($translations as $fields) {
         $event->translations()->create(['title' => $fields['title'], 'description' => $fields['description'], 'lang' => $fields['lang']]);
     }
     DB::commit();
 }
Ejemplo n.º 22
0
 public function run()
 {
     //DB::table('events')->delete();
     // Event1
     Event::create(array('date' => '2015-12-25', 'place' => 'Genève', 'name' => 'Noël', 'capacity' => 8));
     // Event2
     Event::create(array('date' => '2015-12-31', 'place' => 'Lausanne', 'name' => 'Nouvel an', 'capacity' => 10));
     // Event3
     Event::create(array('date' => '2016-02-22', 'place' => 'Nyon', 'name' => 'Anniversaire', 'capacity' => 5));
 }
Ejemplo n.º 23
0
 public function store(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         abort(422);
     }
     $request['user_id'] = Auth::user()->id;
     $event = Event::create([$request->all()]);
     return data(compact('event'));
 }
Ejemplo n.º 24
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     for ($i = 0; $i < 10; $i++) {
         $event['name'] = $faker->name;
         $event['location'] = $faker->address;
         $event['date'] = $faker->name;
         $_event = \App\Event::create($event);
     }
 }
Ejemplo n.º 25
0
 /**
  * Store a newly created resource in storage.
  *
  * @param StoreEventRequest $request
  * @return Response
  */
 public function store(StoreEventRequest $request)
 {
     $input = $request->all();
     //Add the logged in user ID
     $input['user_id'] = \Auth::user()->id;
     //Handle image uploads
     $input['param']['logo'] = $this->uploadImg(Input::file('param.logo'));
     $input['param']['splash_screen'] = $this->uploadImg(Input::file('param.splash_screen'));
     Event::create($input);
     return redirect('event');
 }
Ejemplo n.º 26
0
 public function store(Request $request)
 {
     $user = \JWTAuth::parseToken()->toUser();
     $input = $request->only('local_id', 'description', 'duration');
     $input = array_add($input, 'user_id', $user->id);
     $event = \App\Event::create($input);
     $event->users()->attach($user->id);
     if (!$event) {
         return response()->json(['message' => 'Ups! n00b'], 500);
     }
     return response()->json(['message' => 'Created'], 200);
 }
Ejemplo n.º 27
0
 /**
  * Store a newly created resource.
  *
  * @param  App\Http\Requests\CreateEventRequest
  * @return \Illuminate\Http\Response
  */
 public function store(CreateEventRequest $request)
 {
     if ($request->ajax()) {
         $title = $request->input('title');
         $location = $request->input('location');
         $date = $request->input('date');
         $date = $date === null ? null : new Carbon($date);
         Event::create(compact('title', 'date', 'location'));
         return;
     }
     return redirect(action('EventsController@index'));
 }
Ejemplo n.º 28
0
 public function create(Requests\CreateEventRequest $request)
 {
     $eventData = array('name' => $request['name'], 'timelineDate' => $request['timelineDate']);
     if ($request['summary'] != '') {
         $eventData['summary'] = $request['summary'];
     }
     $event = \App\Event::create($eventData);
     foreach ($request['tags'] as $tag) {
         \App\EventTag::create(['eventID' => $event['id'], 'tag' => $tag]);
     }
     return redirect('/');
 }
Ejemplo n.º 29
0
 /**
  * Store a newly created resource in storage.
  *
  * @param Requests\CreateEventRequest|Request $request
  * @return Response
  */
 public function store(Requests\CreateEventRequest $request)
 {
     $input = $request->all();
     $input['ep'] = $this->_calculateEffortPoints($input);
     $event = Event::create($input);
     if (is_array($input['members'])) {
         foreach ($input['members'] as $memberId) {
             $event->members()->attach($memberId);
         }
     }
     return redirect('events');
 }
Ejemplo n.º 30
0
 public function store(EventRequest $request)
 {
     $user = Auth::user();
     //extract attributes from input
     $attributes = $request->only('name', 'place_name', 'event_type', 'description', 'ticket_cap', 'gmaps_id', 'ticket_price');
     $attributes['ticket_left'] = $request['ticket_cap'];
     $attributes['host_id'] = $user->id;
     // parse date and time to create a carbon instance
     $dateTime = $request['event_date'] . " " . $request['event_time'];
     $attributes['event_time'] = Carbon::createFromFormat('d F, Y H:i', $dateTime);
     // create an Event and associate the user as host
     $event = Event::create($attributes)->host()->associate($user);
     // trim custom tags for whitespace and make array
     $trimmedTags = preg_replace('/\\s+/', '', $request['customTags']);
     $tags = explode(',', $trimmedTags);
     if ($request['tags']) {
         foreach ($request['tags'] as $tag) {
             $event->tags()->attach(Tag::find($tag));
         }
     }
     //
     if ($tags) {
         foreach ($tags as $tag) {
             $event->tags()->attach(Tag::firstOrCreate(array('name' => strtolower($tag))));
         }
     }
     if ($request->file('image')) {
         $imageFile = $request->file('image');
         //make timestamp and append event name for filename
         $timestamp = str_replace([' ', ':'], '-', Carbon::now()->toDateTimeString());
         $filename = $timestamp . '-' . $event->name;
         //remove 'image/' from MIME type
         $mime = "." . substr($imageFile->getMimeType(), 6);
         //move file to /public/images/
         $filename = $timestamp . '-' . $event->name;
         $photoData = array('fileName' => $filename, 'mime' => $mime);
         $photo = Photo::create($photoData);
         //move uploaded file to public dir
         $imageFile->move(public_path() . '/images/uploads/', $filename . $mime);
         //associate the image with the user
         $event->photo_id = $photo->id;
         $event->photo()->associate($photo);
         $event->save();
     }
     // Create QR code.
     $code = QrCode::format('png')->size(350)->generate(url('/events') . '/' . $event->id);
     $qrPath = public_path() . '/images/qrcodes/' . $event->id . '.png';
     File::put($qrPath, $code);
     // show all events
     return Redirect::route('events.show', $event);
 }