本文整理汇总了PHP中App\Repositories\UserRepository::pushCriteria方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::pushCriteria方法的具体用法?PHP UserRepository::pushCriteria怎么用?PHP UserRepository::pushCriteria使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Repositories\UserRepository
的用法示例。
在下文中一共展示了UserRepository::pushCriteria方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postEmail
/**
* Send a reset link to the given user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postEmail(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
$email = $request->input('email');
$user = $this->user->pushCriteria(new UserWhereEmailEquals($email))->all()->first();
Audit::log(null, trans('passwords.audit-log.category'), trans('passwords.audit-log.msg-request-reset', ['email' => $email]));
if (is_null($user)) {
Flash::error(trans(Password::INVALID_USER));
return redirect()->back();
} elseif ($user->auth_type !== 'internal') {
Flash::error(trans('passwords.auth_type'));
return redirect()->back();
} else {
$response = Password::sendResetLink($request->only('email'), function (Message $message) {
$message->subject($this->getEmailSubject());
});
switch ($response) {
case Password::RESET_LINK_SENT:
Flash::success(trans($response));
return redirect()->back()->with('status', trans($response));
case Password::INVALID_USER:
Flash::error(trans($response));
return redirect()->back()->withErrors(['email' => trans($response)]);
}
}
}
示例2: index
/**
* Display a listing of the User.
*
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
$this->authorize('users.view');
$this->userRepository->pushCriteria(new RequestCriteria($request));
$users = $this->userRepository->paginate(50);
return view('users.index')->with('users', $users);
}
示例3: index
/**
* @return \Illuminate\View\View
*/
public function index()
{
$page_title = trans('admin/users/general.page.index.title');
// "Admin | Users";
$page_description = trans('admin/users/general.page.index.description');
// "List of users";
$users = $this->user->pushCriteria(new UsersWithRoles())->pushCriteria(new UsersByUsernamesAscending())->paginate(10);
return view('admin.users.index', compact('users', 'page_title', 'page_description'));
}
示例4: searchByName
public function searchByName(Request $request)
{
$return_arr = null;
$query = $request->input('query');
$users = $this->user->pushCriteria(new UsersWhereFirstNameOrLastNameOrUsernameLike($query))->all();
foreach ($users as $user) {
$id = $user->id;
$first_name = $user->first_name;
$last_name = $user->last_name;
$username = $user->username;
$entry_arr = ['id' => $id, 'text' => "{$first_name} {$last_name} ({$username})"];
$return_arr[] = $entry_arr;
}
return $return_arr;
}
示例5: index
/**
* @return \Illuminate\View\View
*/
public function index()
{
$users = $this->user->pushCriteria(new UsersWithRoles())->paginate(10);
return view('users.index', compact('users'));
}