public function create(Request $req)
 {
     $event = new Event();
     $event->name = $req->input('name');
     $event->save();
     return response()->json(['id' => $event->id]);
 }
 public function testActivityCanBeAddedToAnEvent1()
 {
     $this->logIn();
     $event = new Event();
     $event->name = 'Kokous';
     $event->time = '2016-07-25 16:40:00';
     $event->place = 'Kolo';
     $event->description = 'Iltakokous';
     $event->endDate = '2016-07-25 17:20:20';
     $event->group_id = self::createTestGroup();
     $event->save();
     $activity = new Activity();
     $activity->name = 'Kalastus';
     $activity->guid = 'Guid';
     $activity->age_group = 'sudenpennut';
     $activity->task_group = 'pohjoinen';
     $activity->save();
     $event_id = DB::table('events')->where('name', 'Kokous')->value('id');
     // Pitää muutta occurensejä käyttämään
     /* $this->visit('/events/'. $event_id)
        ->click('Muuta aktiviteetteja')
        ->see('Äänestys')
        ->press('Lisää')
        ->click('Takaisin')
        ->see('Äänestys'); */
 }
Пример #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\CreateEventRequest $request)
 {
     $input = Request::all();
     $event = new Event();
     $event->name = $input['name'];
     $event->save();
     return redirect()->action('EventsController@index');
 }
Пример #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CrearEventRequest $request)
 {
     //dd('hola')
     //echo json_encode($request);
     $event = new Event($request->all());
     $event->save();
     //return redirect('perfil/'.$request->user_id.'/camp/'.$request->camp_id.'/cultiu/'.$event->cultiu_id);
 }
Пример #5
0
 /**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $event = new Event();
     /**
      * [...]
      */
     $event->save();
     return redirect()->route('events.index')->with('message', 'Item created successfully.');
 }
 public function store()
 {
     $seven_days = 60 * 60 * 24 * 7;
     $two_hours = 60 * 60 * 2;
     $season = $_REQUEST['season'];
     $venue_id = $_REQUEST['venue_id'];
     $activity = $_REQUEST['activity'];
     $lastSeasonsLeague = League::where('season', $season - 1)->where('venue_id', $venue_id)->where('activity', $activity)->first();
     $lastSeasonsLastGame = Event::where('league_id', $lastSeasonsLeague->id)->where('week_num', 'Wild Card')->where('game_num', 1)->first();
     $start_dt = $_REQUEST['start_dt'];
     $start_dt = $start_dt ? strtotime($start_dt) : strtotime($lastSeasonsLastGame->date) + $seven_days;
     $start_wk = $_REQUEST['start_wk'];
     $start_wk -= 1;
     $week_cnt = $_REQUEST['week_cnt'];
     $game_cnt = $_REQUEST['game_cnt'];
     $games_tm = $_REQUEST['games_tm'];
     $games_tm = $games_tm ? strtotime($games_tm) : strtotime($lastSeasonsLastGame->time);
     $events = [];
     for ($i = $start_wk; $i <= $week_cnt; $i++) {
         $week_num = $i == $week_cnt ? 'Wild Card' : $i + 1;
         for ($j = 0; $j < $game_cnt; $j++) {
             $datetime = date('Y-m-d', $start_dt + $seven_days * $i) . ' ' . date('H:i:s', $games_tm + $two_hours * $j);
             $game_num = $j + 1;
             $league = League::where('season', $season)->where('venue_id', $venue_id)->where('activity', $activity)->first();
             if (!$league) {
                 $league = new League();
                 $league->season = $season;
                 $league->venue_id = $venue_id;
                 $league->activity = $activity;
                 $league->save();
             }
             $event = new Event();
             $event->league_id = $league->id;
             $event->season = $league->season;
             $event->venue_id = $league->venue_id;
             $event->datetime = $datetime;
             $event->week_num = $week_num;
             $event->game_num = $game_num;
             $event->activity = $league->activity;
             $events[] = $event;
         }
     }
     try {
         DB::transaction(function () use($events) {
             foreach ($events as $event) {
                 $event->save();
             }
         });
         $_SESSION['ALERT'] = alert('Season Added!', "Season {$season} for " . Venue::find($venue_id)->name . " was created successfully.", 'success');
     } catch (Excepton $e) {
         print_r($e);
         exit;
         $_SESSION['ALERT'] = alert('Season Not Added!', "Season {$season} for " . Venue::find($venue_id)->name . " could not be created.", 'error');
     }
     return redirect('/seasons');
 }
Пример #7
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $event = new Event();
     $event->when = new \DateTime($request->input('when'));
     $event->user_id = \Auth::user()->id;
     if ($event->save()) {
         return \Redirect::to('/home')->withMessage(['type' => 'success', 'body' => 'Evento cadastrado com sucesso!']);
     }
     return \Redirect::back()->withMessage(['type' => 'error', 'body' => 'Não foi possivel cadastrar as informações do seu evento'])->withInput();
 }
Пример #8
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $event = new Event();
     $event->name = $request->input('name');
     $event->start_date = $request->input('start_date');
     $event->end_date = $request->input('end_date');
     $event->notes = $request->input('notes');
     $event->save();
     return response()->json(['newId' => $event->id]);
 }
Пример #9
0
 public function newEvent($user)
 {
     $event = new Event();
     $event->user_id = $user->id;
     $event->event_icon = Input::get('icon');
     $event->event_title = Input::get('title');
     $event->event_description = Input::get('description');
     $event->event_date = Input::get('date');
     $event->event_color = Input::get('color');
     $event->save();
 }
Пример #10
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function postCreate(Request $request)
 {
     //
     $date = Carbon::parse($request->input('event_date'))->toDateTimeString();
     $event = new Event();
     $event->event_name = $request->input('event_name');
     $event->event_date = $date;
     $event->event_place = $request->input('event_place');
     $event->event_description = $request->input('event_description');
     $event->save();
     return redirect('/admin/event');
 }
Пример #11
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|min:5|max:15', 'title' => 'required|min:5|max:100', 'time' => 'required|available|duration']);
     $time = explode(" - ", $request->input('time'));
     $event = new Event();
     $event->name = $request->input('name');
     $event->title = $request->input('title');
     $event->start_time = $this->change_date_format($time[0]);
     $event->end_time = $this->change_date_format($time[1]);
     $event->save();
     $request->session()->flash('success', 'The event was successfully saved!');
     return redirect('events/create');
 }
Пример #12
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $event = new Event();
     $event->event_name = $request->event_name;
     $event->event_desc = $request->event_desc;
     $event->event_owner = Auth::user()->id;
     $event->event_loca = $request->event_loca;
     $event->event_type = $request->event_type;
     $event->event_priv = $request->event_priv;
     $event->save();
     //echo $request->nomevent;//esto ya me da el id que necesito para hacer una fk
     return redirect('/event')->with('message', 'Se agrego un nuevo event correctamente');
 }
Пример #13
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CreateEventRequest $request)
 {
     $event = new Event();
     //  $date = date('d-m-Y',Input::get('date'));
     //   dd($date);
     // $date='2015-05-02 12:00:00';
     //$date = Carbon::CreateFromFormat('dd-mm-yyyy', Input::get('date'));
     //dd($date);
     //$usableDate = $date->format('Y-m-d H:i:s');
     $event->date = $date;
     $event->name = Input::get('name');
     $event->user_id = Auth::id();
     $event->save();
     dd($event);
 }
 public function postEvent(EventRequest $request)
 {
     $data = Input::get();
     for ($i = 0; $i < count($data['eventname']); $i++) {
         $c = new Event();
         $c->event = $data['eventname'][$i];
         $c->eventcode = $data['eventcode'][$i];
         $c->date = $data['date'][$i];
         $c->city = $data['city'][$i];
         $c->country = $data['country'][$i];
         $c->save();
     }
     $request->session()->flash('alert-success', 'Event was successful added!');
     return redirect('executor/home');
 }
Пример #15
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $event = new Event();
     $event->description = 'Crack and solve puzzles to find the answer.';
     $event->end_date = Carbon::now()->toIso8601String();
     $event->featured = true;
     $event->image = 'heist.png';
     $event->group_id = 1;
     $event->location = 'GOL-1670';
     $event->name = 'The Heist';
     $event->short_description = 'Crack and solve puzzles to find the answer.';
     $event->short_name = 'Heist';
     $event->start_date = Carbon::now()->toIso8601String();
     $event->save();
 }
Пример #16
0
 public static function createEvent($data)
 {
     $event = new Event();
     $event->event_name = $data['event_name'];
     $event->event_des = $data['event_des'];
     $event->start_time = $data['start_date'] . "--" . $data['start_time'];
     $event->end_time = $data['end_date'] . "--" . $data['end_time'];
     $event->society_id = \Auth::user()->id;
     $event->type = $data['event_type'];
     $event->approve = 0;
     if (!strcmp($data['event_type'], '4')) {
         $event->duration = $data['duration'];
     }
     $event->save();
     return $event;
 }
Пример #17
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CrearCultiuRequest $request)
 {
     //dd("Hola");
     $cultiu = new Cultiu($request->all());
     $cultiu->save();
     $event = new Event();
     $event->headline = "Inici";
     $event->text = "Benvingut";
     $event->startDate = $cultiu->startDate;
     $event->endDate = $cultiu->startDate;
     $event->tevent_id = 1;
     $cultiu->save();
     $event->cultiu_id = $cultiu->id;
     $event->save();
     //	return redirect('home/cultiu/'.$cultiu->id);
 }
Пример #18
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $event = new Event();
     $event->name = \Input::get('name');
     $event->description = \Input::get('description');
     $event->max_player_slots = \Input::get('max_players_number');
     $event->longitude = \Input::get('longitude');
     $event->latitude = \Input::get('latitude');
     $event->user_id = \Auth::id();
     $event->event_date = date('Y-m-d H:i:s', strtotime(\Input::get('event_date')));
     if (!empty(\Input::get('boardgame_select'))) {
         $event->boardgame_id = \Input::get('boardgame_select');
     }
     $event->save();
     return redirect('events/' . $event->id);
 }
Пример #19
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['eventTimeA' => 'required', 'eventTimeB' => 'required', 'eventTimeC' => 'required', 'eventTimeD' => 'required', 'eventTimeE' => 'required', 'eventImgLink' => 'required|max:4']);
     $event = new Event();
     $event->eventTimeA = Input::get('eventTimeA');
     $event->eventTimeB = Input::get('eventTimeB');
     $event->eventTimeC = Input::get('eventTimeC');
     $event->eventTimeD = Input::get('eventTimeD');
     $event->eventTimeE = Input::get('eventTimeE');
     $event->eventImgLink = Input::get('eventImgLink');
     if ($event->save()) {
         return Redirect::to('admin');
     } else {
         return Redirect::back()->withInput()->withErrors('Something Error');
     }
 }
Пример #20
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $v = Validator::make(Request::all(), ['name' => 'required|max:50|unique:events', 'desc' => 'required', 'type' => 'required']);
     if ($v->fails()) {
         return redirect()->back()->withErrors($v->errors())->withInput();
     } else {
         $event = new Event();
         $event->name = Request::get('name');
         $event->desc = Request::get('desc');
         $event->type = Request::get('type');
         $event->privacy = Request::get('privacy');
         $event->save();
         return redirect('events');
     }
 }
 /**
  * Store a newly created event in storage.
  *
  * @param  Request  $request
  * @param  int  $calendar_id
  * @return Response
  */
 public function store(Request $request, $calendar_id)
 {
     $rules = ['summary' => 'required|string', 'start' => 'required|date|before:end', 'end' => 'required|date', 'calendar_id' => 'exists:calendars,id,id,' . $calendar_id];
     $messages = ['required' => 'The :attribute field is required.'];
     $validator = Validator::make($request->all(), $rules, $messages);
     if ($validator->fails()) {
         return response($validator->errors(), 400);
     } else {
         $event = new Event();
         $event->summary = $request->summary;
         $event->start = $request->start;
         $event->end = $request->end;
         $event->calendar_id = $calendar_id;
         $event->save();
         return response($event, 201);
     }
 }
Пример #22
0
 /**
  * La fonction store(Request $request) permet d'ajouter un événement si les données sont valides et que l'événement n'existe pas encore dans la BD selon ses identifiants métiers.
  * @param Request $request - La requête contenant les paramètres.
  * @return Redirect - Une redirection avec les messages selon le bon déroulement de la fonction.
  */
 public function store(Request $request)
 {
     $data = $request->all();
     $validator = Validator::make($request->all(), ['name' => 'required|string', 'date' => 'required|date', 'place' => 'required|string', 'capacity' => 'required|digits_between:0,10']);
     if ($validator->passes()) {
         if (!Event::exist($data['name'], $data['date'], $data['place'])) {
             $event = new Event();
             $event->name = $data['name'];
             $event->date = $data['date'];
             $event->place = $data['place'];
             $event->capacity = $data['capacity'];
             $event->save();
             return redirect('/events')->with('status', 'L\'événement ' . $event->name . ' a été ajouté avec succès!');
         }
         return redirect('/events')->with('error', 'Cet événement existe déjà!');
     }
     return redirect('/events')->withErrors($validator)->withInput();
 }
Пример #23
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['event_name' => 'required', 'event_description' => 'required', 'event_datetime' => 'required']);
     $event = new Event();
     $event->is_published = $request->get('is_published') == 'on' ? 1 : 0;
     $event->name = $request->event_name;
     $event->description = $request->event_description;
     $event->datetime = Carbon::parse($request->event_datetime);
     $event->save();
     if ($request->get('event_categories') != null) {
         foreach ($request->get('event_categories') as $category_id) {
             $event->categories()->attach($category_id);
         }
     }
     $category = new Category();
     $categories = $category->orderBy('name')->get();
     return view('dashboard/create_event')->with('categories', $categories)->with('event', new Event());
 }
Пример #24
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['description' => 'required|string', 'end_date' => 'required|date', 'featured' => 'boolean', 'group' => 'required|exists:groups,id', 'image' => 'required|string', 'location' => 'required|string', 'name' => 'required|string', 'recurrence' => 'string', 'short_description' => 'required|string', 'short_name' => 'required|string', 'start_date' => 'required|date']);
     $event = new Event();
     $event->description = $request->input('description');
     $event->end_date = $request->input('end_date');
     $event->featured = $request->input('featured', false);
     $event->group_id = $request->input('group');
     $event->image = $request->input('image');
     $event->location = $request->input('location');
     $event->name = $request->input('name');
     $event->recurrence = $request->input('recurrence');
     $event->short_description = $request->input('short_description');
     $event->short_name = $request->input('short_name');
     $event->start_date = $request->input('start_date');
     $event->save();
     return new JsonResponse($event, Response::HTTP_CREATED);
 }
Пример #25
0
 public function store(Request $request)
 {
     // dd($request);
     $event = new Event();
     if ($request->event_priv == 'publico') {
         $event->event_priv = 0;
     } else {
         $event->event_priv = 1;
     }
     $event->event_name = $request->event_name;
     $event->event_desc = $request->event_desc;
     $event->event_owner = Auth::user()->id_user;
     $event->event_loca = $request->event_loca;
     $event->event_type = $request->event_type;
     $event->event_date = $request->event_date;
     $event->lat = $request->lat;
     $event->lng = $request->lng;
     $event->save();
     return redirect('/event')->with('message', 'Se agrego un nuevo event correctamente');
 }
Пример #26
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $location = new Location();
     $event = new Event();
     $event->title = $request->title;
     $event->content = $request->content;
     $event->start_date = $request->start_date;
     $event->end_date = $request->end_date;
     $event->start_time = $request->start_time;
     $event->end_time = $request->end_time;
     $event->save();
     $location->number = $request->number;
     $location->street = $request->street;
     $location->suburb = $request->suburb;
     $location->area = $request->area;
     $location->country = $request->country;
     $location->location_map = $request->number . '+' . $request->street . '+,' . $request->suburb . '+,' . $request->area . '+,' . $request->country;
     $location->event_id = $event->id;
     $location->save();
 }
Пример #27
0
 public function save(Request $request)
 {
     if (Customer::whereCustomer_id($request->customer_id)->first()) {
         $order = Order::create($request->all());
         $order->user_id = Auth::user()->id;
         $event = new Event();
         $event->title = $request->title;
         $event->start = $request->booked_at;
         $event->order_id = $request->order_id;
         $end = date_create($request->booked_at);
         date_add($end, date_interval_create_from_date_string($request->estimated_time . ' hours'));
         $event->end = date_format($end, 'Y-m-d H:i');
         $order->save();
         $event->save();
         $order->event_id = $event->id;
         $order->push();
         return redirect('/order/' . $order->id . '/show');
     }
     return redirect('/order/create')->with("session", Alert::get("danger", "Något gick snett.. Försök igen!"));
 }
Пример #28
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //validate
     $this->validate($request, ['event_title' => 'required||unique:events,title|min:10|max:255', 'event_description' => 'min:10|max:500|required', 'event_startdate' => 'required|date', 'event_enddate' => 'required|date', 'event_location' => 'required|max:255']);
     //format dates for mysql
     $event_startdate = $request->event_startdate;
     $event_startdate_formatted = date('Y-m-d H:i:s', strtotime($event_startdate));
     $event_enddate = $request->event_enddate;
     $event_enddate_formatted = date('Y-m-d H:i:s', strtotime($event_enddate));
     //insert
     $event = new Event();
     $event->title = $request->event_title;
     $event->description = $request->event_description;
     $event->event_startdatetime = $event_startdate_formatted;
     $event->event_enddatetime = $event_enddate_formatted;
     $event->user_id = $request->user()->id;
     $event->slug = str_slug($request->event_title);
     $event->location = $request->event_location;
     $event->save();
     Session::flash('message', "Gratz Bro/Sis! Event Saved.");
     return redirect('dashboard');
 }
 public function postEvent(Request $request)
 {
     $rules = array('eventname' => 'required', 'eventcode' => 'required', 'date' => 'required', 'city' => 'required', 'country' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return redirect('home1')->withErrors($validator);
     } else {
         $data = Input::get();
         for ($i = 0; $i < count($data['eventname']); $i++) {
             $c = new Event();
             $c->event = $data['eventname'][$i];
             $c->eventcode = $data['eventcode'][$i];
             $c->date = $data['date'][$i];
             $c->city = $data['city'][$i];
             $c->country = $data['country'][$i];
             $c->save();
         }
     }
     $request->session()->flash('alert-success', 'Event was successful added!');
     return redirect('home1');
     //
 }
 /**
  * Save a new event
  */
 public function postSave()
 {
     $title = Request::input('title');
     $location = Request::input('location');
     $short_desc = Request::input('short_desc');
     $guest = Request::input('guest');
     $long_desc = Request::input('content');
     // Start Datetime & End Datetime
     $get_datetime = explode("-", Request::input('date_event'));
     // start_datetime
     $v_start = explode(" ", $get_datetime[0]);
     $v_start[0] = str_replace('/', '-', $v_start[0]);
     // from yyyy/mm/dd to yyyy-mm-dd
     $start_datetime = $v_start[0] . ' ' . $v_start[1];
     // end_datetime
     $v_end = explode(" ", $get_datetime[1]);
     $v_end[1] = str_replace('/', '-', $v_end[1]);
     // from yyyy/mm/dd to yyyy-mm-dd
     $end_datetime = $v_end[1] . ' ' . $v_end[2];
     // category
     if (Request::input('category') !== null) {
         $category_id = Request::input('category');
     } else {
         $category_id = null;
     }
     $event = new Event();
     $event->user_id = Auth::user()->id;
     $event->category_id = $category_id;
     $event->title = $title;
     $event->location = $location;
     $event->short_desc = $short_desc;
     $event->guest = $guest;
     $event->start_datetime = $start_datetime;
     $event->end_datetime = $end_datetime;
     $event->long_desc = $long_desc;
     $event->save();
     return redirect('event/create-event')->with('success', true);
 }