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


PHP Event::join方法代码示例

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


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

示例1: editForm

 public function editForm()
 {
     $eventNames = \App\Event::get()->pluck('name', 'id')->toArray();
     $mediaNames = \App\Media::get()->pluck('name', 'id')->toArray();
     $eventIDs = \App\Event::get()->pluck('id')->toArray();
     $mediaIDs = \App\Media::get()->pluck('id')->toArray();
     $mediaToEvents = array();
     $eventToMedia = array();
     foreach ($eventIDs as $eventID) {
         $eventToMedia[$eventID] = \App\Media::join('event_media', 'media.id', '=', 'event_media.mediaID')->where('event_media.eventID', $eventID)->get()->pluck('name', 'id')->toArray();
     }
     foreach ($mediaIDs as $mediaID) {
         $mediaToEvents[$mediaID] = \App\Event::join('event_media', 'events.id', '=', 'event_media.eventID')->where('event_media.mediaID', $mediaID)->get()->pluck('name', 'id')->toArray();
     }
     return view('forms/editRelationships')->with(['eventNames' => $eventNames, 'mediaNames' => $mediaNames, 'eventToMedia' => $eventToMedia, 'mediaToEvents' => $mediaToEvents]);
 }
开发者ID:erikkacsm,项目名称:timeline,代码行数:16,代码来源:RelationshipController.php

示例2: show

 public function show($id)
 {
     $media = \App\Media::where('id', $id)->get()->toArray();
     if (empty($media)) {
         App:
         abort(404);
     }
     $media = $media[0];
     $events = \App\Event::join('event_media', 'events.id', '=', 'event_media.eventID')->where('event_media.mediaID', $id)->get()->toArray();
     return view('show/media')->with(['media' => $media, 'events' => $events]);
 }
开发者ID:erikkacsm,项目名称:timeline,代码行数:11,代码来源:MediaController.php

示例3: showUserEvents

 /**
  * Show the user dashboard.
  *
  * @param int $id
  * @return \Illuminate\Http\Response
  */
 public function showUserEvents()
 {
     //Returns all events that the user is attending
     $rsvp = Event::join('rsvp', 'events.id', '=', 'rsvp.eventid')->join('users', 'users.id', '=', 'rsvp.userid')->select('events.*')->where('rsvp.userid', '=', Auth::user()->id)->whereNull('events.deleted_at')->distinct()->get();
     //Returns all events that the user previously attended
     $pastrsvp = Event::join('rsvp', 'events.id', '=', 'rsvp.eventid')->join('users', 'users.id', '=', 'rsvp.userid')->select('events.*')->where('rsvp.userid', '=', Auth::user()->id)->whereNotNull('events.deleted_at')->onlyTrashed()->distinct()->get();
     //Checks if the user is an admin
     $admin = Admin::join('users', 'users.id', '=', 'admins.userid')->select('admins.*')->where(['userid' => Auth::user()->id])->distinct()->get();
     //returns dash view with $rsvp array with query results from above
     return view('dash', ['rsvp' => $rsvp, 'admin' => $admin, 'pastrsvp' => $pastrsvp]);
 }
开发者ID:xRokco,项目名称:websysproject,代码行数:17,代码来源:UserController.php


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