本文整理汇总了PHP中app\Member::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::whereIn方法的具体用法?PHP Member::whereIn怎么用?PHP Member::whereIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Member
的用法示例。
在下文中一共展示了Member::whereIn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTask
function getTask()
{
$user = \Auth::user();
$events = Event::all();
$event = Event::latest('id')->first();
$tasks = Task::all();
$categories = array('Pending', 'In-progress', 'Delayed', 'Finished');
//Array of head->id of user
$heads_comm = Head::where('event_id', $event->id)->where('user_id', $user->id)->get(array('comm_id'))->toArray();
//members of committee
$mem = Member::whereIn('comm_id', $heads_comm)->get(array('user_id'))->toArray();
$members = User::whereIn('id', $mem)->get();
//committees where user is head
$committees = Committee::whereIn('id', $heads_comm)->get();
return view('pages/task', compact('user', 'members', 'events', 'event', 'committees', 'tasks', 'categories'));
}
示例2: getId
public function getId($id)
{
$users = User::all();
$user = $this->getUser();
$curr_event = Event::where('id', $id)->first();
$all_comm = Committee::all();
$committees = Committee::where('event_id', $curr_event->id)->get();
$comm_array = Committee::where('event_id', $curr_event->id)->get(array('id'))->toArray();
$events = Event::all();
$tasks = Task::where('assigned_to', $user['id'])->whereIn('comm_id', $comm_array)->get();
//tasks assigned to current user
$all_tasks = Task::all();
$categories = array('Pending', 'In-progress', 'Delayed', 'Finished');
$comments = Comment::all();
//get current event id
$curr_event_id = $curr_event->id;
//check if current user is upper head
//get all heads of current event
$heads = Head::where('event_id', $curr_event_id)->where('user_id', $user->id)->get();
//get all comm_id(as array) in the current event where current user is a head
$heads_comm = Head::where('event_id', $curr_event_id)->where('user_id', $user['id'])->get(array('comm_id'))->toArray();
//members of committee
$mem = Member::whereIn('comm_id', $heads_comm)->get(array('user_id'))->toArray();
$members = User::whereIn('id', $mem)->get();
//get all committees in the current event where current user is a head
$head_committees = Committee::whereIn('id', $heads_comm)->get();
//current user is a head
$heads_comm = Head::where('user_id', $user['id'])->get();
//committees where current user is a member
$mem_comm = Member::where('user_id', $user['id'])->get();
$url = "pages/profile";
//check if curret user is admin
if ($user->id == 1) {
return redirect('/admin/');
}
//check if current user is OAH
if ($curr_event->oah_id == $user->id) {
$url = "pages/oah";
}
//return heads page if user is lower head
if ($heads != "[]") {
$url = "pages/heads";
}
if ($user->standing == "unconfirmed") {
$url = "pages/oops";
}
echo $url;
return view($url, compact('users', 'user', 'events', 'curr_event', 'all_comm', 'committees', 'tasks', 'all_tasks', 'categories', 'comments', 'head_committees', 'heads_comm', 'mem_comm', 'members'));
}