Reputation: 3506
CONTROLLER
public function index() {
$users = User::all(); // Is there a way to chain it with the except method or sth like that
return View::make('distributors.index')->with('users',$users);
}
GOAL
I want to query all of my users table, but one.
I want to list all the user(s) for my client, but I want to hide my self.
Question
How do I do that ? Am I approaching it in the right way ?
Feel free to give me any suggestions for improvement.
Upvotes: 2
Views: 10080
Reputation: 100195
If you mean except currently logged in user, then do:
$users = User::where('id', '!=', Auth::id())->get();
Upvotes: 10