本文整理汇总了PHP中app\Event类的典型用法代码示例。如果您正苦于以下问题:PHP Event类的具体用法?PHP Event怎么用?PHP Event使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Event类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Studio $studio, Event $event)
{
$event->update($this->prepare($request, $studio));
$event->pieces()->sync($this->prepareTags($request, 'piece_list'));
$event->categories()->sync($this->prepareTags($request, 'category_list'));
return redirect()->action('Admin\\StudioEventsController@show', [$studio->id, $event->id]);
}
示例2: create
public function create(Request $req)
{
$event = new Event();
$event->name = $req->input('name');
$event->save();
return response()->json(['id' => $event->id]);
}
示例3: 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'); */
}
示例4: destroy
/**
* Remove the specified resource from storage.
*
* @param \Illuminate\Http\Request
* @param \App\Event $event
* @return \Illuminate\Http\Response
*/
public function destroy(Request $request, Event $event)
{
if ($request->ajax()) {
$event->delete();
return;
}
return redirect(action('EventsController@index'));
}
示例5: 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');
}
示例6: 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();
}
示例7: toggleParticipant
protected function toggleParticipant(Event $event)
{
$isParticipant = !empty(EventUser::where('user_id', $this->request->participant_id)->where('event_id', $event->id)->first());
if ($isParticipant) {
$event->users()->detach([$this->request->participant_id]);
$value = -1;
} else {
$event->users()->attach([$this->request->participant_id]);
$value = 1;
}
return data([compact('value')]);
}
示例8: 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();
}
示例9: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$faker = \Faker\Factory::create();
$user = User::create(['name' => 'Christian Kasperbauer', 'email' => 'chris.kasperbauer@gmail.com', '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();
}
示例10: getIndex
/**
* Display a listing of the resource.
*
* @return Response
*/
public function getIndex()
{
$varr = Auth::user()->empid;
$empid = Targetassign::where('Employeeid', $varr)->get();
$cat = Event::all();
return View('targetmodule/eventdeal')->with(array('cat' => $cat, 'empid' => $empid));
}
示例11: index
/**
* Render front page view
* @return VIEW welcome
*/
public function index()
{
$all_events = Event::where('time', '>', date('Y-m-d H:i:s'))->orderBy(DB::raw('RAND()'));
$first_six = $all_events->take(6)->get();
$next_six = $all_events->skip(6)->take(6)->get();
return View::make('welcome')->with('first_six', $first_six)->with('next_six', $next_six);
}
示例12: home
/**
* Display a home page.
*
* @return Response
*/
public function home()
{
$activeUsers = 3;
$totalUsers = User::all()->count();
$eventCount = Event::all()->count();
return view('admin.home', compact('activeUsers', 'totalUsers', 'eventCount'));
}
示例13: getAssigntarget
public function getAssigntarget()
{
$employee = Employee::all();
$categories = Event::all();
$userdetails = User::all();
$targets = Targetassign::all();
$deals = Deal::all();
$userData = array();
$key = 0;
foreach ($targets as $target) {
$achieved = 0;
$userData[$key]['eventcode'] = $target->Eventcode;
$userData[$key]['event'] = $target->Eventname;
$userData[$key]['employee'] = $target->Employeeid;
$userData[$key]['targetVal'] = $target->Targetvalue;
foreach ($deals as $deal) {
if ($target->Eventcode == $deal->Eventcode && $target->Employeeid == $deal->Empid) {
$achieved = $achieved + $deal->Dealvalue;
}
}
$userData[$key]['achieved'] = $achieved;
$userData[$key]['variance'] = $achieved - $target->Targetvalue;
$userData[$key]['cur'] = $target->Currency;
$key++;
}
return View('approval/assigntarget')->with(array('categories' => $categories, 'employee' => $employee, 'userdata' => $userData, 'targets' => $targets, 'eventtable' => $categories));
}
示例14: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$lastPosts = Post::latest()->take(2)->get();
$lastEvents = Event::latest()->take(2)->get();
$lastEvents2 = Event::latest()->skip(2)->take(2)->get();
return view('welcome')->with('lastPosts', $lastPosts)->with('lastEvents', $lastEvents)->with('lastEvents2', $lastEvents2);
}
示例15: store
/**
* 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);
}