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


PHP User::whereIn方法代码示例

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


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

示例1: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Project $project, User $user)
 {
     $admin = JWTAuth::parseToken()->authenticate();
     $audience = User::whereIn('id', explode(',', $request->get('audience')))->get();
     $this->dispatch(new RemoveUserFromProject($admin, $project, $user, $audience));
     return response()->json(['success' => true, 'message' => 'User Left Project.']);
 }
开发者ID:bluecipherz,项目名称:bczapi,代码行数:13,代码来源:UserController.php

示例2: index

 public function index()
 {
     $classes = StudyClass::all();
     $teacher_ids = array();
     $assist_ids = array();
     foreach ($classes as $class) {
         if ($class->teach != null) {
             $teacher_ids[] = $class->teach->id;
         }
         if ($class->assist != null) {
             $assist_ids[] = $class->assist->id;
         }
     }
     $teachers = User::whereIn('id', $teacher_ids)->get();
     foreach ($teachers as &$teacher) {
         $class_ids = array();
         foreach ($teacher->teach as $t) {
             $class_ids[] = $t->id;
         }
         $teacher->rating_number = Register::whereIn('class_id', $class_ids)->where('rating_teacher', '>', -1)->count();
         $teacher->rating_avg = Register::whereIn('class_id', $class_ids)->where('rating_teacher', '>', -1)->avg('rating_teacher');
     }
     $assistants = User::whereIn('id', $assist_ids)->get();
     foreach ($assistants as &$assistant) {
         $class_ids = array();
         foreach ($assistant->assist as $t) {
             $class_ids[] = $t->id;
         }
         $assistant->rating_number = Register::whereIn('class_id', $class_ids)->where('rating_ta', '>', -1)->count();
         $assistant->rating_avg = Register::whereIn('class_id', $class_ids)->where('rating_ta', '>', -1)->avg('rating_ta');
     }
     $this->data['teachers'] = $teachers;
     $this->data['assistants'] = $assistants;
     return view('manage.personal_rating.all', $this->data);
 }
开发者ID:Kaelcao,项目名称:colormev2,代码行数:35,代码来源:PersonalRatingController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Project $project, Request $request)
 {
     $user = JWTAuth::parseToken()->authenticate();
     $audience = User::whereIn('id', explode(',', $request->get('audience')))->get();
     $forum = $this->dispatch(new PostForum($user, $project, $request->all(), $audience));
     return response()->json(['success' => true, 'message' => 'Forum Posted.', 'forum' => $forum]);
 }
开发者ID:bluecipherz,项目名称:bczapi,代码行数:12,代码来源:ForumController.php

示例4: refresh

 public function refresh()
 {
     if (!\Session::get('user')->is_admin()) {
         abort(401);
     }
     $group_id = config('gapper.group_id');
     $members = Client::getMembers($group_id);
     if (count($members)) {
         $deleted_users = User::all()->lists('gapper_id', 'id')->toArray();
         foreach ($members as $member) {
             $id = $member['id'];
             $user = User::where('gapper_id', $id)->first();
             if (!$user) {
                 $user = new \App\User();
                 $user->gapper_id = $member['id'];
                 $user->name = $member['name'];
                 $user->icon = $member['icon'];
             } else {
                 $user->name = $member['name'];
                 $user->icon = $member['icon'];
                 //从 deleted_users 中删除当前 gapper_id 对应的用户
                 //最后剩下的, 就是 User 中不包含 gapper_id 的用户
                 if (array_key_exists($member['id'], $deleted_users)) {
                     unset($deleted_users[$id]);
                 }
             }
             $user->save();
         }
         //发现有需要删除的 User
         if (count($deleted_users)) {
             $to_deleted_users = User::whereIn('id', array_values($deleted_users))->delete();
         }
     }
     return redirect()->to('users')->with('message_content', '同步成功!')->with('message_type', 'info');
 }
开发者ID:genee-projects,项目名称:snail,代码行数:35,代码来源:UserController.php

示例5: postGroupList

 public function postGroupList(Request $request)
 {
     //新增职务
     if ($request->has('new_cp_group_name')) {
         $new_cp_group_name = $request->input('new_cp_group_name');
         if (in_array($new_cp_group_name, array('系统管理员', '超级管理员')) || AdminGroup::where('cp_group_name', '=', $new_cp_group_name)->first()) {
             return redirect($this->redirectPath('/user/groups'))->withErrors([Lang::get('access.addNewCpGroupFailed')]);
         }
         $adminGroup = new AdminGroup();
         $adminGroup->cp_group_name = strip_tags($new_cp_group_name);
         $adminGroup->save();
     }
     //更新职务
     if ($request->has('name')) {
         foreach ($request->input('name') as $cp_group_id => $cp_group_name) {
             $adminGroup = AdminGroup::find($cp_group_id);
             $adminGroup->cp_group_name = $cp_group_name;
             $adminGroup->save();
         }
     }
     //删除职务
     if ($request->has('delete')) {
         AdminAccess::destroy($request->input('delete'));
         User::whereIn('cp_group_id', $request->input('delete'))->delete();
         AdminGroup::destroy($request->input('delete'));
     }
     return redirect($this->redirectPath('/user/groups'))->with($this->statusVar, Lang::get('access.updateCpGroupSuccess'));
 }
开发者ID:sylvanasGG,项目名称:laravel_lte,代码行数:28,代码来源:PermController.php

示例6: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mail)
 {
     $group = $this->ticket->group_id;
     $customers = Group::where('id', $group)->first()->customers()->get();
     $_customers = [];
     foreach ($customers as $customer) {
         $_customers[] = $customer->id;
     }
     $sys_name = Settings::where('name', 'sys_name')->first();
     $user = User::whereIn('customer_id', $_customers)->get();
     foreach ($user as $_user) {
         $mail->send('emails.updateticket', ['user' => $_user, 'ticket' => $this->ticket, 'response' => $this->response, 'sys_name' => $sys_name], function ($m) use($_user) {
             $m->to($_user->email, $_user->first_name . ' ' . $_user->last_name)->subject('Ticket updated - ' . $this->ticket->track_id . ' [' . $this->ticket->status->name . ']');
             if (count($this->response->attachments()->get()) > 0) {
                 foreach ($this->response->attachments as $attachment) {
                     $m->attach(storage_path() . '/attachments/' . $this->ticket->id . '/' . $attachment->name);
                 }
             }
         });
     }
     // Cleanup variables
     unset($this->ticket);
     unset($this->response);
     unset($group);
     unset($customers);
     unset($user);
     unset($sys_name);
     unset($_customers);
 }
开发者ID:stryker250,项目名称:simple_ticket,代码行数:34,代码来源:EmailUpdatedTicket.php

示例7: notify

 public static function notify($idArr = array(), $body, $type, $to_all = 0, $is_system = 0)
 {
     $currentId = auth()->id();
     if (!$currentId) {
         return;
     }
     $data = $notifiedUidArr = [];
     $now = \Carbon\Carbon::now();
     if ($to_all) {
         $data = ['user_id' => 0, 'body' => $body, 'type' => $type, 'to_all' => $to_all, 'is_system' => $is_system, 'created_at' => $now, 'updated_at' => $now];
     } elseif (!empty($idArr)) {
         $idArr = array_unique($idArr);
         foreach ($idArr as $id) {
             if ($id == $currentId) {
                 return;
             }
             $data[] = ['user_id' => $id, 'body' => $body, 'type' => $type, 'to_all' => $to_all, 'is_system' => $is_system, 'created_at' => $now, 'updated_at' => $now];
             $notifiedUidArr[] = $id;
         }
     }
     if (!empty($data)) {
         Notify::insert($data);
         if ($to_all) {
             \DB::table('users')->increment('notice_count');
         } elseif ($notifiedUidArr) {
             User::whereIn('id', $notifiedUidArr)->increment('notice_count');
         }
     }
 }
开发者ID:misterebs,项目名称:cmsku,代码行数:29,代码来源:Notify.php

示例8: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $projectdetails = ['name' => 'shitzu', 'description' => 'frickzena oah auhsdoh vgos'];
     $taskdetails = ['name' => 'joozie', 'description' => 'ahioihd poaiy7u ascihogyfcd pouaou'];
     $taskdetails2 = ['name' => 'ambroze', 'description' => 'shitzu prickzen la frickzen'];
     $statusdetails = ['message' => 'hello wazzup?'];
     DB::table('projects')->delete();
     DB::table('users_projects')->delete();
     DB::table('stories')->delete();
     DB::table('sprints')->delete();
     DB::table('backlogs')->delete();
     // optional
     DB::table('comments')->delete();
     DB::table('statuses')->delete();
     $user1 = User::firstOrFail();
     $user2 = User::all()->last();
     $project = Bus::dispatch(new CreateProject($user1, $projectdetails));
     Bus::dispatch(new AddUserToProject($user1, $project, $user2, 'developer'));
     $users = User::whereIn('id', [$user1->id, $user2->id])->get();
     $backlog = App\Backlog::create(['name' => 'Release Elixir']);
     $user1->backlogs()->save($backlog);
     $project->backlogs()->save($backlog);
     $sprint = App\Sprint::create(['name' => 'Sprint Shikku']);
     $project->sprints()->save($sprint);
     $backlog->sprints()->save($sprint);
     $user1->sprints()->save($sprint);
     $datas = [['name' => 'Refactoring Iceblocks', 'description' => 'Cool tasks are always cool. So do this !!', 'priority' => 1, 'work_hours' => '7'], ['name' => 'Streaming section', 'description' => 'This is one of the besttask ever i ve seen in my life time => )', 'priority' => 0, 'work_hours' => '2'], ['name' => 'Urgent Completion', 'description' => 'This is a urgent task . U should make the system flow for ever', 'priority' => 3, 'work_hours' => '8'], ['name' => 'Elangent Model shift', 'description' => 'Super awesome task you will love it i know ...!!', 'priority' => 2, 'work_hours' => '5'], ['name' => 'Bug trakking system', 'description' => 'This task is for powerful people.. Yeah you..! ', 'priority' => 1, 'work_hours' => '2'], ['name' => 'Featured blog completion', 'description' => 'This is a urgent task . U should make the system flow for ever', 'priority' => 3, 'work_hours' => '6'], ['name' => 'Quick finish', 'description' => 'Super awesome task you will love it i know it, can you just finish this.. ? sothat we can move On..', 'priority' => 0, 'work_hours' => '7'], ['name' => 'Trapped module refactoring', 'description' => 'Super awesome task you will love it i know ...!!', 'priority' => 3, 'work_hours' => '2'], ['name' => 'Smooth UI Design', 'description' => 'This is a urgent task . U should make the system flow for ever', 'priority' => 2, 'work_hours' => '4'], ['name' => 'Refactoring Iceblocks', 'description' => 'Major refactor needed in the sublimentory section of zylanfuzku Masked version.Its all about the stuffs and stone of the rechard steven.', 'priority' => 0, 'work_hours' => '7'], ['name' => 'Urgent Completion', 'description' => 'This is a urgent task . U should make the system flow for ever', 'priority' => 3, 'work_hours' => '8'], ['name' => 'Elangent Model shift', 'description' => 'Super awesome task you will love it i know ...!!', 'priority' => 2, 'work_hours' => '5'], ['name' => 'Bug trakking system', 'description' => 'This task is for powerful people.. Yeah you..! ', 'priority' => 1, 'work_hours' => '2'], ['name' => 'Featured blog completion', 'description' => 'This is a urgent task . U should make the system flow for ever', 'priority' => 3, 'work_hours' => '6'], ['name' => 'Quick finish', 'description' => 'Super awesome task you will love it i know it, can you just finish this.. ? sothat we can move On..', 'priority' => 0, 'work_hours' => '7'], ['name' => 'Trapped module refactoring', 'description' => 'Super awesome task you will love it i know ...!!', 'priority' => 3, 'work_hours' => '2'], ['name' => 'Quick finish', 'description' => 'Super awesome task you will love it i know it, can you just finish this.. ? sothat we can move On..', 'priority' => 0, 'work_hours' => '7'], ['name' => 'Trapped module refactoring', 'description' => 'Super awesome task you will love it i know ...!!', 'priority' => 3, 'work_hours' => '2'], ['name' => 'Smooth UI Design', 'description' => 'This is a urgent task . U should make the system flow for ever', 'priority' => 2, 'work_hours' => '4'], ['name' => 'Refactoring Iceblocks', 'description' => 'Major refactor needed in the sublimentory section of zylanfuzku Masked version.Its all about the stuffs and stone of the rechard steven.', 'priority' => 0, 'work_hours' => '7'], ['name' => 'Urgent Completion', 'description' => 'This is a urgent task . U should make the system flow for ever', 'priority' => 3, 'work_hours' => '8'], ['name' => 'Elangent Model shift', 'description' => 'Super awesome task you will love it i know ...!!', 'priority' => 2, 'work_hours' => '5'], ['name' => 'Bug trakking system', 'description' => 'This task is for powerful people.. Yeah you..! ', 'priority' => 1, 'work_hours' => '2'], ['name' => 'Featured blog completion', 'description' => 'This is a urgent task . U should make the system flow for ever', 'priority' => 3, 'work_hours' => '6'], ['name' => 'Quick finish', 'description' => 'Super awesome task you will love it i know it, can you just finish this.. ? sothat we can move On..', 'priority' => 0, 'work_hours' => '7'], ['name' => 'Trapped module refactoring', 'description' => 'Super awesome task you will love it i know ...!!', 'priority' => 3, 'work_hours' => '2'], ['name' => 'Quick finish', 'description' => 'Super awesome task you will love it i know it, can you just finish this.. ? sothat we can move On..', 'priority' => 0, 'work_hours' => '7'], ['name' => 'Trapped module refactoring', 'description' => 'Super awesome task you will love it i know ...!!', 'priority' => 3, 'work_hours' => '2']];
     foreach ($datas as $data) {
         $story = App\Story::create($data);
         $project->stories()->save($story);
         $user1->createdStories()->save($story);
     }
 }
开发者ID:bluecipherz,项目名称:bczapi,代码行数:38,代码来源:ProjectsTasksTableSeeder.php

示例9: parse

 public function parse($body)
 {
     $this->body_original = $body;
     $this->usernames = $this->getMentionedUsername();
     count($this->usernames) > 0 && ($this->users = User::whereIn('name', $this->usernames)->get());
     $this->replace();
     return $this->body_parsed;
 }
开发者ID:stevejobsii,项目名称:gg,代码行数:8,代码来源:Mention.php

示例10: dependentsOkay

 public static function dependentsOkay($dependentIDList)
 {
     $accountID = Auth::user()->id;
     $matchCount = User::whereIn('id', $dependentIDList)->where(function ($query) use($accountID) {
         $query->where('accountId', '=', $accountID)->where('approved', '<>', 'false');
     })->count();
     return $matchCount == sizeof($dependentIDList);
 }
开发者ID:a161527,项目名称:cs319-p2t5,代码行数:8,代码来源:CheckDependents.php

示例11: getUsersString

 public static function getUsersString($id)
 {
     $result = "";
     $_users = ConversationUser::where(['conversation_id' => $id])->get(['user_id']);
     $users = User::whereIn('id', $_users)->get();
     foreach ($users as $user) {
         if ($user->id != Auth::id()) {
             $result = $result . $user->name . " " . $user->surname . ", ";
         }
     }
     return rtrim($result, ", ");
 }
开发者ID:eldorplus,项目名称:laravel5.1_social_network,代码行数:12,代码来源:ConversationsController.php

示例12: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $images = Picture::where('user_id', '=', Auth::user()->id)->where('isDish', '=', false)->orderBy('id', 'desc')->take(5)->get();
     $profile = User::find(Auth::user()->id);
     $favoriteDish = explode(';', $profile->favoriteDish);
     $time = explode("-", $profile->dateOfBirth);
     $dt = Carbon::createFromDate($time[0], $time[1], $time[2], 'Europe/Brussels');
     $now = Carbon::today();
     $age = $now->diffInYears($dt);
     $profile->age = $age;
     foreach ($favoriteDish as $key => $value) {
         if ($value == "") {
             unset($favoriteDish[$key]);
         }
     }
     $profile->favoriteDishArray = $favoriteDish;
     $friends = User::where('id', '=', Auth::user()->id)->first()->friends()->get();
     $friendRequests = Friend::where('friend_id', '=', Auth::user()->id)->where('accepted', '=', false)->get();
     $mayLike = array();
     foreach ($profile->tastes as $taste) {
         $othersTaste = $taste->users()->where('user_id', '<>', Auth::user()->id)->where('taste_id', $taste->id)->get();
         foreach ($othersTaste as $user) {
             $mayLike[] = $user->id;
         }
     }
     //count how many times an id apears in array
     $CountMayLikes = array_count_values($mayLike);
     //sort from high to low
     arsort($CountMayLikes);
     //var_dump($CountMayLikes);
     $sortedArray = [];
     foreach ($CountMayLikes as $id => $value) {
         $sortedArray[] = $id;
     }
     //var_dump($sortedArray);
     //give te first 10z
     $pYML = array_slice($sortedArray, 0, 10);
     $people = User::whereIn('id', $pYML)->select('id', 'name', 'surname', 'country', 'city', 'dateOfBirth')->get();
     foreach ($people as $person) {
         // var_dump($person->id);
         $picture_url = Picture::where('user_id', $person->id)->select('picture_url')->first();
         // echo '<pre>';
         // var_dump($picture_url['picture_url']);
         $person->picture_url = $picture_url['picture_url'];
     }
     $smaken = Taste::select('id', 'tastes')->get();
     $tasts = array();
     foreach ($smaken as $smaak) {
         $tasts[$smaak->id] = $smaak->tastes;
     }
     $data = ['profile' => $profile, 'friends' => $friends, 'friendRequests' => $friendRequests, 'images' => $images, 'tasts' => $tasts, 'peoples' => $people];
     return View('dashboard')->with($data);
 }
开发者ID:jeroenjvdb,项目名称:projecten-dinner-date,代码行数:58,代码来源:MainController.php

示例13: index

 public function index(Request $request)
 {
     // 获取排序条件
     $orderColumn = $request->get('sort_up', $request->get('sort_down', 'created_at'));
     $direction = $request->get('sort_up') ? 'asc' : 'desc';
     $members = User::whereIn('level', ['003', '002'])->whereHas('roles', function ($query) {
         $query->where('slug', 'member');
     })->orderBy($orderColumn, $direction)->paginate(8);
     $nonMembers = User::where('level', '001')->whereHas('roles', function ($query) {
         $query->where('slug', 'member');
     })->orderBy($orderColumn, $direction)->paginate(8);
     return view('admin.user.list', compact('members', 'nonMembers', 'query'));
 }
开发者ID:Kangaroos,项目名称:restart-reserve,代码行数:13,代码来源:UserController.php

示例14: 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'));
 }
开发者ID:zoekayvee,项目名称:YSESTracker,代码行数:16,代码来源:TaskController.php

示例15: addMember

 public function addMember(AddMemberToProjectRequest $request)
 {
     $owner = Auth::user();
     $users_id = $request->users;
     // 傳進來的資料再做一次搜尋,確定傳進來的資料在資料庫都存在
     $users = User::whereIn('id', $users_id)->get();
     $projectId = $request->project_id;
     $project = $owner->projects()->find($projectId);
     $relationshipData = [];
     foreach ($users as $user) {
         $relationshipData[] = $user->id;
     }
     // 為project加入關聯
     $project->users()->attach($relationshipData, ['role' => $request->role]);
     return $project->users()->whereIn('id', $users_id)->get();
 }
开发者ID:shana0440,项目名称:project-management-system,代码行数:16,代码来源:ProjectController.php


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