當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Event::save方法代碼示例

本文整理匯總了PHP中app\Event::save方法的典型用法代碼示例。如果您正苦於以下問題:PHP Event::save方法的具體用法?PHP Event::save怎麽用?PHP Event::save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Event的用法示例。


在下文中一共展示了Event::save方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create

 public function create(Request $req)
 {
     $event = new Event();
     $event->name = $req->input('name');
     $event->save();
     return response()->json(['id' => $event->id]);
 }
開發者ID:alexalexandresq,項目名稱:ConCalendar,代碼行數:7,代碼來源:EventController.php

示例2: testActivityCanBeAddedToAnEvent1

 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'); */
 }
開發者ID:partio-scout,項目名稱:kokous_backend,代碼行數:26,代碼來源:ActivityViewTest.php

示例3: store

 /**
  * 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');
 }
開發者ID:jacqhernandez,項目名稱:lsopcs,代碼行數:14,代碼來源:EventsController.php

示例4: store

 /**
  * 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);
 }
開發者ID:vi1004t,項目名稱:pfg,代碼行數:13,代碼來源:EventController.php

示例5: store

 /**
  * 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.');
 }
開發者ID:jbenner-radham,項目名稱:v-phoenix,代碼行數:15,代碼來源:EventController.php

示例6: store

 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');
 }
開發者ID:MadeByGlutard,項目名稱:GreenMountainGaming.com,代碼行數:56,代碼來源:SeasonsController.php

示例7: store

 /**
  * 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();
 }
開發者ID:jaschweder,項目名稱:tcc,代碼行數:15,代碼來源:EventController.php

示例8: store

 /**
  * 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]);
 }
開發者ID:breenyoung,項目名稱:wfadmin,代碼行數:16,代碼來源:EventController.php

示例9: newEvent

 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();
 }
開發者ID:mathewsandi,項目名稱:Practice,代碼行數:11,代碼來源:CalendarRepository.php

示例10: postCreate

 /**
  * 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');
 }
開發者ID:palhimanshu1991,項目名稱:dastangoi,代碼行數:17,代碼來源:EventController.php

示例11: store

 /**
  * 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');
 }
開發者ID:pisyek,項目名稱:room-booking-system,代碼行數:19,代碼來源:EventController.php

示例12: store

 /**
  * 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');
 }
開發者ID:jona872,項目名稱:planear5,代碼行數:19,代碼來源:EventController.php

示例13: store

 /**
  * 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);
 }
開發者ID:simonigd,項目名稱:seating,代碼行數:21,代碼來源:EventsController.php

示例14: postEvent

 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');
 }
開發者ID:harshithanaiduk,項目名稱:iclock-newtheme,代碼行數:15,代碼來源:ExecutorController.php

示例15: run

 /**
  * 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();
 }
開發者ID:kocsenc,項目名稱:api,代碼行數:20,代碼來源:EventTableSeeder.php


注:本文中的app\Event::save方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。