本文整理汇总了PHP中App\Model\User::all方法的典型用法代码示例。如果您正苦于以下问题:PHP User::all方法的具体用法?PHP User::all怎么用?PHP User::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Model\User
的用法示例。
在下文中一共展示了User::all方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mailer)
{
$users = Model\User::all(['first_name']);
/** @var Model\User[] $users */
foreach ($users as $user) {
$mailer->raw(sprintf("Hi %s,\nWe have a new book %s by %s.\nRegards,\nYour Library", $user->first_name, $this->book->title, $this->book->author), function ($message) use($user) {
$message->subject('Brand new book');
$message->from(getenv('EMAIL_FROM'));
$message->to($user->email);
});
}
}
示例2: viewusers
function viewusers(Request $request)
{
$users = User::all();
$data['users'] = $users;
$data['menu'] = 5;
return view('viewusers', $data);
}
示例3: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$users = User::all();
return $this->respond(['data' => $this->UserTransformer->transformCollection($users->toArray())]);
}
示例4: getUser
public function getUser()
{
return User::all();
}
示例5: getUsers
/**
* Get all users in database or return error.
*
* @return string
*/
public static function getUsers()
{
return User::all();
}
示例6: indexAction
public function indexAction()
{
$users = User::all();
$data['users'] = $users;
return $this->render('user/index.html.twig', $data);
}
示例7: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$users = User::all();
return response()->json($users);
}
示例8: dispatch
public function dispatch(Request $request, Response $response, $args)
{
$this->logger->info("Home page action dispatched");
$this->view->render($response, 'home.twig', ['user' => User::all()]);
return $response;
}
示例9: borrowView
/**
* @param Request $request
* @param $bookId
* @return \Illuminate\View\View
*/
public function borrowView(Request $request, $bookId)
{
$book = Book::find($bookId);
return view('book.borrow', ['book' => $book, 'users' => User::all()->keyBy('id')->map(function ($item) {
return $item->first_name . ' ' . $item->last_name;
})]);
}
示例10: all
public function all()
{
return User::all();
}
示例11: cli
public function cli()
{
$users = User::all();
echo $users->toJson();
}