本文整理汇总了PHP中app\Event::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::whereIn方法的具体用法?PHP Event::whereIn怎么用?PHP Event::whereIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Event
的用法示例。
在下文中一共展示了Event::whereIn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: goingEvents
/**
* Display a listing of my going events.
*
* @return Response
*/
public function goingEvents()
{
$events = Event::whereIn('id', function ($query) {
$query->select('event_id')->from('event_user')->where('user_id', \Auth::id());
})->where('date_start', '>=', new \DateTime('today'))->orderBy('date_start')->select(array('id', 'name'))->paginate();
$tittle = 'Going';
return view('events', compact('events', 'tittle'));
}
示例2: registeredevents
public function registeredevents()
{
$user = Auth::user();
$eventid = Register::where('userid', $user->id)->lists('eventid');
$events = Event::whereIn('id', $eventid)->get();
$festid = Event::whereIn('id', $events->toArray())->lists('festid');
$fests = Fest::whereIn('id', $festid);
return view('user.regevents', ['user' => Auth::user(), 'fests' => $fests, 'events' => $events]);
}
示例3: handle
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
if ($this->user->unsubscribed_email != "no") {
$soc_ids = DB::table('subscriptions')->where('user_id', $this->user->id)->lists('society_id');
// All Events, in user subscribed society, next week.
$events = Event::whereIn('society_id', $soc_ids)->where('time', '>', date('Y-m-d H:i:s'))->where('time', '<', date('Y-m-d H:i:s', time() + 604800));
$allEvents = $this->events->toArray();
if (count($allEvents)) {
$random_event = $allEvents[array_rand($allEvents, 1)];
$data = ['user' => $this->user, 'events' => $events, 'random_event' => $random_event];
Mail::send('emails.weekly', $data, function ($message) {
$message->from('lowdown@netsoc.co', 'Lowdown');
$message->subject('Your Weekly Society Lowdown');
$message->to($this->user->email);
});
}
}
}
示例4: manageableRolesForUser
private function manageableRolesForUser()
{
$roles = $this->roleResultToList(Role::with('perms')->get());
if (Entrust::can(PermissionNames::ManageGlobalPermissions())) {
return $roles;
}
//Filter out global permissions
$roles = array_filter($roles, function ($r) {
$globalPerms = PermissionNames::AllGlobalPermissions();
foreach ($r->perms as $p) {
if (in_array($p->name, $globalPerms)) {
return false;
}
}
return true;
});
$confPermNamePart = PermissionNames::normalizePermissionName(PermissionNames::ConferencePermissionManagement(1));
$evtPermNamePart = PermissionNames::normalizePermissionName(PermissionNames::EventPermissionManagement(1));
//Get the permissions this user has which are permissions management
//permissions
$currentPermManagement = Permission::whereHas("roles", function ($query) {
$query->whereHas("users", function ($query) {
//on Account table
$query->where("id", Auth::user()->id);
});
})->where(function ($query) use($confPermNamePart, $evtPermNamePart) {
$query->where('name', 'like', $confPermNamePart . '%');
$query->orWhere('name', 'like', $evtPermNamePart . '%');
})->get();
$conferences = [];
$events = [];
foreach ($currentPermManagement as $perm) {
if (PermissionNames::isConferencePermission($perm->name)) {
$conferences[] = PermissionNames::extractPermissionData($perm->name)->idPart;
} else {
$events[] = PermissionNames::extractPermissionData($perm->name)->idPart;
}
}
$ownedEvents = Event::whereIn('conferenceID', $conferences)->select('id')->get();
$ownedEvents = array_map(function ($e) {
return $e['id'];
}, $ownedEvents->toArray());
$events = array_merge($events, $ownedEvents);
//Filter out permissions not associated with the conferences/events
//this user can control.
$roles = array_filter($roles, function ($r) use($events, $conferences) {
foreach ($r->perms as $p) {
if (PermissionNames::isConferencePermission($p->name)) {
$confId = PermissionNames::extractPermissionData($p->name)->idPart;
if (!in_array($confId, $conferences)) {
return false;
}
} else {
if (PermissionNames::isEventPermission($p->name)) {
$evtId = PermissionNames::extractPermissionData($p->name)->idPart;
if (!in_array($evtId, $events)) {
return false;
}
}
}
return true;
}
});
return $roles;
}
示例5: dopublish
private function dopublish(Request $request, $value)
{
$event = Event::whereIn('id', $request->ids)->update(array('is_published' => $value));
$response = ['model_type' => 'Event', 'ids' => $request->ids, 'action_type' => $value == 1 ? "Publish" : "Unpublish"];
return json_encode($response);
}