本文整理汇总了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);
}
示例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'));
}
示例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]);
}
示例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'));
}
示例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'));
}
示例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;
}
示例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);
}
示例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]);
}
示例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]);
}
示例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();
}
示例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'));
}
示例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'));
}
}
示例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);
}