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


PHP User::whereNotIn方法代码示例

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


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

示例1: getPaginated

 /**
  * Get a paginated list of all users
  * 	
  *	@param int $howMany
  * 	
  *	@param string $byKeyword
  *
  *	@return mixed
  */
 public function getPaginated($howMany = 10, $byFirstname = null)
 {
     if (is_null($byFirstname)) {
         return User::whereNotIn('id', [Auth::user()->id])->orderBy('firstname', 'asc')->paginate($howMany);
     }
     return User::whereNotIn('id', [Auth::user()->id])->where('firstname', 'like', '%' . $byFirstname . '%')->orderBy('firstname', 'asc')->paginate($howMany);
 }
开发者ID:aku345,项目名称:Larasocial,代码行数:16,代码来源:EloquentUserRepository.php

示例2: index

 public function index($id)
 {
     $group = Group::findOrFail($id);
     $users = User::whereNotIn('id', $group->users()->get()->map(function ($item, $key) {
         return $item->id;
     }))->get();
     return view('groupUsers', compact('group', 'users'));
 }
开发者ID:partio-scout,项目名称:kokous_backend,代码行数:8,代码来源:GroupUserController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $userActive = Auth::user();
     if ($userActive->role == 'admin') {
         $users = User::whereNotIn('role', ['admin'])->get();
     } else {
         $users = User::whereNotIn('role', ['operator', 'admin'])->get();
     }
     return view('users.index', ['users' => $users, 'user' => $userActive]);
 }
开发者ID:satriowisnugroho,项目名称:LIST,代码行数:15,代码来源:UserController.php

示例4: index

 /**
  * Show the Administrator panel.
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     try {
         $user = Auth::user()->with('projects')->where('id', '=', '2')->firstOrFail();
     } catch (ModelNotFoundException $e) {
         return Redirect::home();
     }
     // if it's admin, redirect to admin cms with all users but admin
     $allUsers = User::whereNotIn('id', [2])->get();
     $allSponsors = Sponsor::all();
     // Retrieve all projects pending approval.
     $pendingProjects = Project::where('approved', '=', '0')->where('application_status', '=', '1')->where('live', '=', '0')->get();
     return view('adminpanel.index', compact('user', 'allUsers', 'pendingProjects', 'allSponsors'));
 }
开发者ID:andreikainer,项目名称:kuj_abol,代码行数:19,代码来源:AdminController.php

示例5: show

 /**
  * Shows a message thread
  *
  * @param $id
  * @return mixed
  */
 public function show($id)
 {
     try {
         $thread = Thread::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         Session::flash('error_message', 'The thread with ID: ' . $id . ' was not found.');
         return redirect('messages');
     }
     // don't show the current user in list
     $userId = Auth::user()->id;
     $users = User::whereNotIn('id', $thread->participantsUserIds($userId))->get();
     $thread->markAsRead($userId);
     return view('messenger.show', compact('thread', 'users'));
 }
开发者ID:crgriggs,项目名称:fishark,代码行数:20,代码来源:MessagesController.php

示例6: show

 /**
  * Shows a message thread.
  *
  * @param $id
  * @return mixed
  */
 public function show($subject)
 {
     try {
         $thread = Thread::where('subject', $subject)->first();
     } catch (ModelNotFoundException $e) {
         echo "error";
     }
     // show current user in list if not a current participant
     // $users = User::whereNotIn('id', $thread->participantsUserIds())->get();
     // don't show the current user in list
     $userId = Authorizer::getResourceOwnerId();
     $users = User::whereNotIn('id', $thread->participantsUserIds($userId))->get();
     $thread->markAsRead($userId);
     return $thread->messages;
 }
开发者ID:Scaledesk,项目名称:gritwings,代码行数:21,代码来源:MessagesController.php

示例7: show

 /**
  * Shows a message thread
  *
  * Example URL: GET /api/v1/messages/1?api_key=30ce6864e2589b01bc002b03aa6a7923
  *
  * @param MessageTransformer $messageTransformer
  * @param $id
  * @return mixed
  */
 public function show(MessageTransformer $messageTransformer, $id)
 {
     $userId = $this->user->id;
     try {
         $thread = Thread::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         return $this->respondNotFound('Sorry, the message thread was not found.');
     }
     $thread->markAsRead($userId);
     $messageData = $thread->toArray();
     // Get messages
     $messages = $thread->messages()->with('user')->get();
     $messageData['messages'] = $messages->toArray();
     // Get participants
     $participants = User::whereIn('id', $thread->participantsUserIds())->get();
     $messageData['participants'] = $participants->toArray();
     // Get non-participants
     $nonParticipants = User::whereNotIn('id', $thread->participantsUserIds())->get();
     $messageData['non_participants'] = $nonParticipants->toArray();
     $data = $messageTransformer->transform($messageData);
     $response = ['data' => $data];
     return $this->respondWithSuccess($response);
 }
开发者ID:emtudo,项目名称:lumen-messenger-api,代码行数:32,代码来源:MessagesController.php

示例8: updateThread

 public function updateThread($id)
 {
     try {
         $thread = Thread::findOrFail($id);
     } catch (ModelNotFoundException $e) {
         Session::flash('error_message', 'The thread with ID: ' . $id . ' was not found.');
         return redirect('messages');
     }
     $thread->activateAllParticipants();
     // Message
     Message::create(['thread_id' => $thread->id, 'user_id' => Auth::id(), 'body' => Input::get('message')]);
     // Add replier as a participant
     $participant = Participant::firstOrCreate(['thread_id' => $thread->id, 'user_id' => Auth::user()->id]);
     $participant->last_read = new Carbon();
     $participant->save();
     // Recipients
     if (Input::has('recipients')) {
         $thread->addParticipants(Input::get('recipients'));
     }
     $userId = Auth::user()->id;
     $users = \App\User::whereNotIn('id', $thread->participantsUserIds($userId))->get();
     return view('messages.show', ['page' => 'message', 'thread' => $thread, 'users' => $users]);
 }
开发者ID:manishdwibedy,项目名称:SCaller,代码行数:23,代码来源:MessageController.php

示例9: viewUsers

 public function viewUsers()
 {
     $this->authorize('viewAdmin');
     $users_array = User::whereNotIn('id', [1, 4])->get();
     $projects = Project::all();
     //$projects = Project::lists('title','id', 'user');
     //dd($projects_array);
     return view('admin.users', ['users' => $users_array, 'projects' => $projects]);
 }
开发者ID:JackHammersmith,项目名称:DankScrum,代码行数:9,代码来源:AdminController.php

示例10: getPotentialInvitees

 /**
  * Get the users who could be invited into the conversation
  * 
  * @return Collection
  */
 public function getPotentialInvitees()
 {
     $current_participants = $this->participants()->lists('id');
     return \App\User::whereNotIn('id', $current_participants)->get();
 }
开发者ID:computerfr33k,项目名称:confer,代码行数:10,代码来源:Conversation.php

示例11: editTeam

 public function editTeam($id)
 {
     if (!$this->auth()) {
         return "You have no Permissions!";
     }
     $team = team::where('teamID', '=', $id)->first();
     $students = team_contents::where('teamID', '=', $id)->get(array('studentID'));
     $s = array();
     foreach ($students as $a) {
         array_push($s, $a->studentID);
     }
     $teamContents = User::whereIn('id', $s)->get();
     $allStudents = User::whereNotIn('id', $s)->get();
     return view('editTeam', compact('team', 'teamContents', 'allStudents'));
 }
开发者ID:apatel23,项目名称:CSCI445_final_project_12_6,代码行数:15,代码来源:StudentController.php

示例12: getUserinfo

 public function getUserinfo(Request $request)
 {
     if ($request->has('s')) {
         $users = $this->returnSearchObj('users', $request->input('s'));
         return view('dashboard.userinfo', ['objs' => $users[0], 'searchStr' => $users[1]]);
     } else {
         $objs = User::whereNotIn('admin', [99])->paginate($this->pg);
         return view('dashboard.userinfo', compact('objs'));
     }
 }
开发者ID:szcrystal,项目名称:woau_backup,代码行数:10,代码来源:DashBoardController.php

示例13: getAll

 /**
  * Get List of all users.
  *
  * @param array $formData search data
  * @return Collection
  */
 public function getAll($id)
 {
     $users = $this->user->whereNotIn('id', [$id]);
     return $users->paginate(1);
 }
开发者ID:shavo21,项目名称:shopping,代码行数:11,代码来源:UserService.php


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