当前位置: 首页>>代码示例>>PHP>>正文


PHP Event::find方法代码示例

本文整理汇总了PHP中app\Event::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::find方法的具体用法?PHP Event::find怎么用?PHP Event::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Event的用法示例。


在下文中一共展示了Event::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addGuest

 /**
  * La fonction addGuest(Request $request) permet d'ajouter un invité à un événement si ce dernier existe, qu'il n'est pas complet et si les données sont valides.
  * @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 addGuest(Request $request)
 {
     $data = $request->all();
     $validator = Validator::make($request->all(), ['eventId' => "required|integer", 'first_name' => 'required|string', 'last_name' => 'required|string', 'email' => 'required|email', 'gender' => 'required|string|in:male,female']);
     if ($validator->passes()) {
         if (Event::existTechId($data['eventId'])) {
             $event = Event::find($data['eventId']);
             if (Event::isNotSoldOut($event->id)) {
                 if (!Guest::exist($data['email'])) {
                     $guest = new Guest();
                     $guest->first_name = $data['first_name'];
                     $guest->last_name = $data['last_name'];
                     $guest->email = $data['email'];
                     $guest->gender = $data['gender'];
                     $guest->save();
                 } else {
                     $guest = Guest::where('email', $data['email'])->first();
                     if (Guest::participateToEvent($data['eventId'], $guest->id)) {
                         return redirect('/events')->with('error', $guest->first_name . ' ' . $guest->last_name . ' participe déjà à l\'événement ' . $event->name);
                     }
                 }
                 $event->guests()->attach($guest->id);
                 return redirect('/events')->with('status', $guest->first_name . ' ' . $guest->last_name . ' a été ajouté à l\'événement ' . $event->name);
             }
             return redirect('/events')->with('error', 'Cet événement est complet');
         }
         return redirect('/events')->with('error', 'Cet événement n\'existe pas');
     }
     return redirect('/events')->withErrors($validator)->withInput();
 }
开发者ID:cliengme,项目名称:eventmanager,代码行数:35,代码来源:EventController.php

示例2: join

 public function join($eventId)
 {
     $user = \JWTAuth::parseToken()->toUser();
     $event = \App\Event::find($eventId);
     $event->users()->attach($user->id);
     response()->json(['message' => 'User Joined Event'], 200);
 }
开发者ID:hfalucas,项目名称:hackacity-api,代码行数:7,代码来源:EventsController.php

示例3: index

 /**
  * Our index page listing all stations
  *
  * @author David Varney
  */
 public function index(Request $request)
 {
     $default_event = Event::first();
     $event_id = $request->input('event_id', $default_event->id);
     $event = Event::find($event_id);
     $stations = $event->stations()->get();
     return view('admin.station_data.index', array('title' => 'Admin: Station Data', 'stations' => $stations, 'event_id' => $event_id, 'events' => Event::lists('name', 'id')));
 }
开发者ID:davidvarney,项目名称:tagmovement,代码行数:13,代码来源:StationDataController.php

示例4: showEventDiary

 public function showEventDiary($eventId, $page = 1)
 {
     $pageSize = 10;
     $accountArray = Cache::get('accountList');
     if (!Cache::has('tradeList-' . $eventId . '-' . $page)) {
         Cache::put('tradeList-' . $eventId . '-' . $page, Trade::where('event_id', '=', $eventId)->orderBy('trade_at', 'asc')->skip(($page - 1) * $pageSize)->take($pageSize)->get(), 10);
     }
     return view('event.diary')->with(['eventList' => Cache::get('events'), 'eventInfo' => Event::find($eventId), 'tradeList' => Cache::get('tradeList-' . $eventId . '-' . $page), 'accountList' => json_encode($accountArray), 'fileLinkList' => DiaryAttachedFiles::where('event_id', '=', $eventId)->get(), 'totalPageNumber' => ceil(Trade::where('event_id', '=', $eventId)->count() / $pageSize), 'currentPageNumber' => $page]);
 }
开发者ID:seisyo,项目名称:Verthandi,代码行数:9,代码来源:DiaryController.php

示例5: uploadFiles

 /**
  * View to allow users to upload photos to an event
  * @param  Request $request
  * @param  string  $encryptedEventID
  * @return array The data necessary to pass to the view
  */
 public static function uploadFiles($encryptedEventID)
 {
     $data['eventID'] = Crypt::decrypt($encryptedEventID);
     $data['event'] = Event::find($data['eventID']);
     if (Auth::check()) {
         $data['images'] = Auth::user()->media->where('event_id', $data['eventID'])->sortBy('id');
     }
     return $data;
 }
开发者ID:TheJokersThief,项目名称:Eve,代码行数:15,代码来源:MediaController.php

示例6: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //
     $event = Event::find($id);
     if (!$event) {
         return response()->json(['error' => 'Event does not exist', 'code' => 'e101'], 404);
     }
     return response()->json(['data' => $this->transform($event->toArray())], 200);
 }
开发者ID:harshithanaiduk,项目名称:iclock-newtheme,代码行数:15,代码来源:EventsapiController.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     for ($i = 1; $i <= 3; $i++) {
         $partner = Partner::find($i);
         $event = Event::find(1);
         $distance = LocationController::getMapsMatrixDistance($event->location, $partner->location);
         $event->partners()->save($partner, ['distance' => $distance]);
     }
 }
开发者ID:TheJokersThief,项目名称:Eve,代码行数:14,代码来源:EventPartnersTableSeeder.php

示例8: buildPartnerResultByEvent

 public static function buildPartnerResultByEvent($id)
 {
     $event = Event::find($id);
     $partners = $event->partners;
     foreach ($partners as $partner) {
         $partner->type = $partner->type->name;
     }
     return $partners;
 }
开发者ID:VolodyaP,项目名称:wapp,代码行数:9,代码来源:Partner.php

示例9: getEventAttendee

 /**
  * @param $crsid
  * @return mixed
  */
 public function getEventAttendee($event_id, $crsid)
 {
     $event = Event::find($event_id);
     if ($event === null) {
         return null;
     }
     $attendee = $event->attendees()->where('crsid', strtolower($crsid))->first();
     return $attendee;
 }
开发者ID:CUMSA,项目名称:members,代码行数:13,代码来源:EventAttendeesController.php

示例10: testMarkingActivitiesToUsers

 public function testMarkingActivitiesToUsers()
 {
     $this->logIn();
     session()->set('admin', 1);
     self::initData();
     $event = Event::find(1);
     $group = $event->group;
     $eventOccurrence = $event->eventOccurrences->first();
     $this->visit('/events/' . $event->id . '/occurrences/' . $eventOccurrence->id)->check($group->users->first()->id)->press('Merkitse suoritetuiksi')->seePageIs('/events/' . $event->id . '/occurrences/' . $eventOccurrence->id)->seeInDatabase('activity_user', ['activity_id' => $eventOccurrence->activities->first()->id, 'user_id' => $group->users->first()->id]);
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:10,代码来源:EventOccurrenceViewTest.php

示例11: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     if (!($event = Event::find($id))) {
         return \Redirect::to('/home')->withError('Evento não encontrado');
     }
     if ($event->delete()) {
         return \Redirect::to('/home')->withMessage(['type' => 'success', 'body' => 'Evento excluído com sucesso']);
     }
     return \Redirect::back()->withMessage(['type' => 'error', 'body' => 'Não foi possivel excluir as informações do seu evento'])->withInput();
 }
开发者ID:jaschweder,项目名称:tcc,代码行数:16,代码来源:EventController.php

示例12: deleteEvent

 public function deleteEvent()
 {
     $result = ['success' => false];
     $id = Input::get('id');
     if (isset($id) && !empty($id) && Event::find($id)) {
         $event = Event::find($id);
         $event->delete();
         $result['success'] = true;
     }
     return json_encode($result);
 }
开发者ID:aminodrago,项目名称:laravel-fullcalendar-demo,代码行数:11,代码来源:EventsController.php

示例13: eventMissingCrucialInformation

function eventMissingCrucialInformation($id)
{
    $event = \App\Event::find($id);
    if (\App\Category::find($event->type)) {
        return false;
    }
    if (strlen($event->description) < 1) {
        return false;
    }
    return true;
}
开发者ID:OrvilSavery,项目名称:spontanunity,代码行数:11,代码来源:helpers.php

示例14: showevent

 public function showevent($id, $event)
 {
     $user = Auth::user();
     $reg = NULL;
     if ($user) {
         $reg = Register::where('userid', $user->id)->where('eventid', $event)->first();
     }
     $fest = Fest::find($id);
     $event = Event::find($event);
     return view('user.event', ['user' => Auth::user(), 'event' => $event, 'fest' => $fest, 'reg' => $reg]);
 }
开发者ID:helloworldprojects,项目名称:FestManager,代码行数:11,代码来源:PageController.php

示例15: data

 /**
  * Return json for DataTables.
  *
  * @return \Illuminate\Http\Response
  */
 public function data($event_id)
 {
     // grab event
     $event = Event::find($event_id);
     // grab rows
     $advisors = Advisor::leftJoin('schools', 'advisors.school_id', '=', 'schools.id')->leftJoin('attendees', 'advisors.id', '=', 'attendees.advisor_id')->leftJoin('invoices', 'invoices.advisor_id', '=', 'advisors.id')->select(['advisors.id', 'advisors.created_at', 'advisors.name', 'advisors.email', 'advisors.attending_advisor', 'advisors.comments', 'schools.name as school', 'schools.region as region', DB::raw('count(attendees.id) as attendees'), 'invoices.key as invoice'])->where('advisors.event_id', $event_id)->groupBy('advisors.id')->get();
     return Datatables::of($advisors)->editColumn('created_at', '{{ $created_at->toDateTimeString() }}')->editColumn('attendees', '<a href="{{ url(\'/admin/event/' . $event_id . '/advisor/\'.$id.\'/attendees\') }}">{{ $attendees }}</a>')->editColumn('invoice', '<a href="{{ url(\'/event/' . $event->slug . '/invoice/\'.$invoice) }}"><i class="icon-file"></i></a>')->addColumn('actions', '
             <a href="{{ url(\'admin/event/' . $event_id . '/advisor/\'.$id.\'/edit\') }}" class="btn btn-primary btn-xs"><i class="icon-pencil"></i></a>
             <a href="{{ url(\'admin/event/' . $event_id . '/advisor/\'.$id.\'/remove\') }}" class="btn btn-danger btn-xs"><i class="icon-remove"></i></a>
         ')->make(true);
 }
开发者ID:Hipp04,项目名称:registered-solutions,代码行数:16,代码来源:AdvisorController.php


注:本文中的app\Event::find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。