本文整理汇总了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]);
}
示例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'); */
}
示例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');
}
示例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);
}
示例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.');
}
示例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');
}
示例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();
}
示例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]);
}
示例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();
}
示例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');
}
示例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');
}
示例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');
}
示例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);
}
示例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');
}
示例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();
}