/** * 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('/'); }
/** * 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]); }
/** * 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); }
/** * 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')); }
/** * 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()]); } } }
/** * 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)]); } } }
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')); }
/** * 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); }
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); }
/** * 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')); }
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); }
public function execute($hasCode) { if (!$hasCode) { return $this->getAuthFirst(); } $user = $this->users->findByEmailOrCreate($this->getGithubUser()); Auth::loginUsingId($user->id, true); return redirect('/profile'); }
/** * 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; }
/** * 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)); }
/** * @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); }
/** * @param $request * @param $listener * @param $provider * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function execute($request, $listener, $provider) { if (!$request) { return $this->getAuthorizationFirst($provider); } $user = $this->users->findByUserNameOrCreate($this->getSocialUser($provider)); $this->auth->login($user, true); return $listener->userHasLoggedIn($user); }
public function execute($provider, $hasCode, AuthenticateUserListener $listener) { if (!$hasCode) { return $this->getAuthorizationFirst($provider); } $user = $this->users->findByUsernameOrCreate($provider, $this->getProviderUser($provider)); $this->auth->login($user, true); return $listener->userHasLoggedIn($user); }
/** * @param boolean $hasCode * @param AuthenticateUserListener $listener * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function execute($hasCode, AuthenticateUserListener $listener, $provider) { if (!$hasCode) { return $this->getAuthorizationFirst($provider); } $user = $this->users->findByEmailOrCreate($this->getSocialUser($provider)); \Auth::login($user, true); return $listener->userHasLoggedIn($user); }
/** * Show the media panel. * * @return Response */ public function filemanager(ContactRepository $contact_gestion, BlogRepository $blog_gestion, CommentRepository $comment_gestion) { $url = config('medias.url'); $nbrMessages = $contact_gestion->getNumber(); $nbrUsers = $this->user_gestion->getNumber(); $nbrPosts = $blog_gestion->getNumber(); $nbrComments = $comment_gestion->getNumber(); return view('back.filemanager', compact('url', 'nbrMessages', 'nbrUsers', 'nbrPosts', 'nbrComments')); }
/** * Create user registration. * * @param Request $request * @param AppMailer $mailer * @return \Illuminate\Http\RedirectResponse */ public function postRegister(Request $request, AppMailer $mailer) { $this->validate($request, $this->validateRegistrationForm()); $user = $this->users->create($request->all()); if (Auth::attempt($this->getCredentials($request))) { $mailer->sendEmailVerificationTo($user); } return redirect('/'); }
/** * Execute the job. * * @return void */ public function handle(UserRepository $userRepository) { $user = $userRepository->find($this->user['id']); if (!Hash::check($this->params['old_password'], $user->password)) { throw new PasswordNotMatch(); } $password = bcrypt($this->params['password']); return $userRepository->update($this->user['id'], ['password' => $password]); }
public function getResend(UserRepository $user_gestion, Request $request) { if ($request->session()->has('user_id')) { $user = $user_gestion->getById($request->session()->get('user_id')); $this->dispatch(new SendMail($user)); return redirect('/')->with('ok', trans('front/verify.resend')); } return redirect('/'); }
/** * Show the settings dashboard. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function show(Request $request) { $data = ['activeTab' => $request->get('tab', Spark::firstSettingsTabKey()), 'invoices' => [], 'user' => $this->users->getCurrentUser()]; if (Auth::user()->stripe_id) { $data['invoices'] = Cache::remember('spark:invoices:' . Auth::id(), 30, function () { return Auth::user()->invoices(); }); } return view('settings.dashboard', $data); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $tu = $this->userRepository->getTotal(); $tp = $this->productRepository->getTotal(); $tc = $this->categoryRepository->getTotal(); $tt = $this->tagRepository->getTotal(); $op = Option::count(); $pm = $this->paymentRepository->getTotal(); return View('admin.dashboard.index')->with(compact('tu', 'tp', 'tc', 'tt', 'op', 'pm')); }
public function execute($hasCode, AuthenticateUserListener $listener) { if (!$hasCode) { return $this->getAuthorizationFirst(); } else { $user = $this->users->findByUsernameOrCreate($this->getGithubUser()); $this->guard->login($user, true); return $listener->userHasLoggedIn($user); } }
public function handle(UserRepository $user_repo, SettingRepository $setting_repo) { $sample = $this->sample; $users = $user_repo->getAll(); $settings = $setting_repo->getWithSlugKeys(); foreach ($users as $user) { Mail::send('mail.notify_admin_of_new_sample', ['sample' => $sample, 'settings' => $settings], function ($m) use($sample, $user) { $m->to($user->email, $user->name)->subject('Anmeldung Probe ' . $sample->generated_number); }); } }
/** * 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(); $tasklistall = Tasklist::all(); Session::put('tasklisttkey', $tasklistall); $taskcount = Tasklist::count(); Session::put('taskcountkey', $taskcount); return view('back.index', compact('nbrMessages', 'nbrUsers', 'nbrPosts', 'nbrComments', 'taskcountkey', 'tasklisttkey')); }
/** * 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->name, $request->sens); $links = $posts->appends(['name' => $request->name, 'sens' => $request->sens]); if ($request->ajax()) { return response()->json(['view' => view('back.blog.table', compact('statut', 'posts'))->render(), 'links' => $links->setPath('order')->render()]); } $links->setPath('')->render(); $order = (object) ['name' => $request->name, 'sens' => 'sort-' . $request->sens]; return view('back.blog.index', compact('posts', 'links', 'order')); }
/** * Execute the command. * * @param Hasher $hasher * @param UserRepository $users * @return User * @throws UserAlreadyExistsException */ public function handle(Hasher $hasher, UserRepository $users) { try { $users->findByEmail($this->email); throw new UserAlreadyExistsException($this->email); } catch (ModelNotFoundException $e) { $user = User::register($this->name, $this->email, $hasher->make($this->password), 'admin'); $users->save($user); event(new UserWasRegistered($user)); return $user; } }
/** * Add the User to the Database and Authenticate * @param Request $request * @param User $repo */ public function addUser(CrateUserRequest $request, User $repo) { $role = \App\Role::where('name', 'user')->get()->first(); $user = $repo->create($request->all()); $user->attachRole($role); Auth::attempt(['email' => $user->email, 'password' => $user->password]); return redirect()->route()->intended('registration'); }