本文整理汇总了PHP中App\Repositories\UserRepository类的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository类的具体用法?PHP UserRepository怎么用?PHP UserRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UserRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postRegister
/**
* Handle a registration request for the application.
*
* @param \Illuminate\Http\Request $request
* @param App\Repositories\UserRepository
* @return \Illuminate\Http\Response
*/
public function postRegister(Request $request, UserRepository $userRepository)
{
$this->validate($request, ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6']);
$user = $userRepository->store($request);
Auth::login($user);
return redirect('/');
}
示例2: index
/**
* Display a list of active talents
*
* @param UserRepository $userRepository
* @return $this
*/
public function index(UserRepository $userRepository)
{
$talents = $userRepository->findActiveTalents(Input::get('tag'), Input::get('describes'), Input::get('location'), null, 12, Input::get('professions'));
$describes = Skill::lists('name', 'id')->all();
$professions = Profession::lists('name', 'id')->all();
return view('talent.index')->with('talents', $talents)->with('describes', $describes)->with('professions', $professions);
}
示例3: showAccueil
/**
* Retourne la vue d'accueil de l'étudiant
*
* @return View
*/
public function showAccueil(UserRepository $userRepository)
{
$recherche = $this->etudiantRepository->getRecherche($this->etudiant->id);
$suggestions = $this->getSuggestions();
$responsables = $userRepository->getListModerateurs($this->etudiant->promotion_id);
return view('etudiant.home', compact('recherche', 'suggestions', 'responsables'));
}
示例4: postRegister
public function postRegister(RegisterRequest $request, UserRepository $user_gestion)
{
$user = $user_gestion->storeUserRegister($request);
$this->dispatch(new SendMail($user));
$alertClass = "alert-success";
$message = "ChickenElectric thông báo.Bạn đã đăng ký thành công tài khoản. Để hoàn tất bạn hãy truy cập email để kích hoạt tài khoản.";
return redirect(route('website.index'))->with(compact('message', 'alertClass'));
}
示例5: ProviderStub
function it_creates_a_user_if_authorization_is_granted(Factory $socialite, UserRepository $repository, Guard $guard, User $user, AuthenticateUserListener $listener)
{
$socialite->driver('github')->willReturn(new ProviderStub());
$repository->findByUsernameOrCreate(ProviderStub::$data)->willReturn($user);
// $guard->login($user, static::HAS_CODE)->shouldBeCalled();
// $listener->userHasLoggedIn($user)->shouldBeCalled();
$this->execute(self::HAS_CODE, $listener);
}
示例6: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(UserRepository $userRepository)
{
$user = $userRepository->findByUsername($this->username, ['userType']);
$type = null;
if ($user) {
$type = $user->userType->type;
}
return $type;
}
示例7: handle
/**
* Execute the job.
*
* @param UserRepository $repository
* @return void
*/
public function handle(UserRepository $repository)
{
$person = User::addHouseholdMember($this->firstname, $this->lastname, $this->middleinitial, $this->gender, $this->mobile_no, $this->email);
$repository->save($person);
$member = HouseholdMember::addMember($this->household_id, $person->id);
$household = Household::findOrFail($this->household_id);
$household->members()->save($member);
event(new UserHasRegistered($person));
}
示例8: indexOrder
/**
* Display a listing of the resource.
*
* @param Illuminate\Http\Request $request
* @return Response
*/
public function indexOrder(Request $request)
{
$statut = $this->user_gestion->getStatut();
$posts = $this->blog_gestion->index(10, $statut == 'admin' ? null : $request->user()->id, $request->input('name'), $request->input('sens'));
$links = str_replace('/?', '?', $posts->render());
return response()->json(['view' => view('back.blog.table', compact('statut', 'posts'))->render(), 'links' => $links]);
}
示例9: index
/**
* Show all notifications
*
* @return string
*/
public function index()
{
try {
//Get the notifications for the currently logged in user
$notifications = $this->userRepo->paginateNotifications($this->auth->user());
//Get next Page url
$nextPageUrl = generate_next_page_url($notifications);
//This is not an ajax request
if (!$this->input->is_ajax_request()) {
//Load view with data
$this->load->view('pages/notifications', compact('notifications', 'nextPageUrl'));
} else {
//Is an ajax request
echo json_encode(['error' => false, 'grid' => $this->load->view('pages/partials/_notifications-grid', compact('notifications'), true), 'nextPageUrl' => $nextPageUrl]);
}
} catch (Exception $e) {
//This is not an ajax request
if (!$this->input->is_ajax_request()) {
//Show error page
show_404();
} else {
//Is an ajax request
echo json_encode(['error' => true, 'message' => $e->getMessage()]);
}
}
}
示例10: 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)]);
}
}
}
示例11: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$user = $this->userRepository->find($this->authorizer->getResourceOwnerId());
App::singleton('user', function () use($user) {
return $user->toArray();
});
return $next($request);
}
示例12: admin
/**
* Show the admin panel.
*
* @param App\Repositories\ContactRepository $contact_gestion
* @param App\Repositories\BlogRepository $blog_gestion
* @param App\Repositories\CommentRepository $comment_gestion
* @return Response
*/
public function admin(ContactRepository $contact_gestion, BlogRepository $blog_gestion, CommentRepository $comment_gestion)
{
$nbrMessages = $contact_gestion->getNumber();
$nbrUsers = $this->user_gestion->getNumber();
$nbrPosts = $blog_gestion->getNumber();
$nbrComments = $comment_gestion->getNumber();
return view('back.index', compact('nbrMessages', 'nbrUsers', 'nbrPosts', 'nbrComments'));
}
示例13: execute
public function execute($hasCode, $listener, $provider)
{
if (!$hasCode) {
return $this->getAuthorization($provider);
}
$user = $this->users->findByUsernameOrCreate($this->getUser($provider));
$this->auth->login($user, true);
return $listener->userAuthenticated($user);
}
示例14: execute
public function execute($hasCode)
{
if (!$hasCode) {
return $this->getAuthFirst();
}
$user = $this->users->findByEmailOrCreate($this->getGithubUser());
Auth::loginUsingId($user->id, true);
return redirect('/profile');
}
示例15: google
/**
* @param boolean $hasCode
* @param AuthenticateUserListener $listener
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*/
public function google($hasCode, AuthenticateUserListener $listener)
{
if (!$hasCode) {
return $this->socialite->driver('google')->redirect();
}
$user = $this->users->findByUsernameOrCreate($this->socialite->driver('google')->user());
$this->auth->login($user, true);
return $listener->userHasLoggedIn($user);
}