【发布时间】:2015-01-16 05:44:02
【问题描述】:
控制器
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);
}
目标
我想查询我的所有用户表,但只有一个。
我想为我的客户列出所有用户,但我想隐藏自己。
问题
我该怎么做? 我是否以正确的方式接近它?
请随时给我任何改进建议。
【问题讨论】:
-
我对 laravel 不太熟悉,但你能用
User::Where('id', '!=', '1')->get();之类的东西吗? 1 是你的用户 ID -
究竟是什么@VincentMatte 是正确的答案。
-
@VincentMatte:你说得对!!
-
在这里你可以找到更好的解决方案stackoverflow.com/a/32627797/7373178
标签: php mysql database laravel-4 blade