1 | <?php namespace Modules\User\Http\Controllers; |
||
14 | class AuthController extends BasePublicController |
||
15 | { |
||
16 | use DispatchesJobs; |
||
17 | |||
18 | public function __construct() |
||
19 | { |
||
20 | parent::__construct(); |
||
21 | |||
22 | } |
||
23 | |||
24 | public function getLogin() |
||
28 | |||
29 | public function postLogin(LoginRequest $request) |
||
30 | { |
||
31 | $credentials = [ |
||
32 | 'email' => $request->email, |
||
|
|||
33 | 'password' => $request->password, |
||
34 | ]; |
||
35 | $remember = (bool) $request->get('remember_me', false); |
||
36 | |||
37 | $error = $this->auth->login($credentials, $remember); |
||
38 | if (!$error) { |
||
39 | flash()->success(trans('user::messages.successfully logged in')); |
||
40 | |||
41 | return redirect()->intended('/'); |
||
42 | } |
||
43 | |||
44 | flash()->error($error); |
||
45 | |||
46 | return redirect()->back()->withInput(); |
||
47 | } |
||
48 | |||
49 | public function getRegister() |
||
50 | { |
||
51 | return view('user::public.register'); |
||
52 | } |
||
53 | |||
54 | public function postRegister(RegisterRequest $request) |
||
55 | { |
||
56 | app(UserRegistration::class)->register($request->all()); |
||
57 | |||
58 | flash()->success(trans('user::messages.account created check email for activation')); |
||
59 | |||
60 | return redirect()->route('register'); |
||
61 | } |
||
62 | |||
63 | public function getLogout() |
||
64 | { |
||
65 | $this->auth->logout(); |
||
66 | |||
67 | return redirect()->route('login'); |
||
68 | } |
||
69 | |||
70 | public function getActivate($userId, $code) |
||
71 | { |
||
72 | if ($this->auth->activate($userId, $code)) { |
||
73 | flash()->success(trans('user::messages.account activated you can now login')); |
||
74 | |||
75 | return redirect()->route('login'); |
||
76 | } |
||
77 | flash()->error(trans('user::messages.there was an error with the activation')); |
||
78 | |||
79 | return redirect()->route('register'); |
||
80 | } |
||
81 | |||
82 | public function getReset() |
||
86 | |||
87 | public function postReset(ResetRequest $request) |
||
88 | { |
||
89 | try { |
||
90 | app(UserResetter::class)->startReset($request->all()); |
||
91 | } catch (UserNotFoundException $e) { |
||
92 | flash()->error(trans('user::messages.no user found')); |
||
93 | |||
94 | return redirect()->back()->withInput(); |
||
95 | } |
||
96 | |||
97 | flash()->success(trans('user::messages.check email to reset password')); |
||
98 | |||
99 | return redirect()->route('reset'); |
||
100 | } |
||
101 | |||
102 | public function getResetComplete() |
||
106 | |||
107 | public function postResetComplete($userId, $code, ResetCompleteRequest $request) |
||
108 | { |
||
109 | try { |
||
110 | app(UserResetter::class)->finishReset( |
||
111 | array_merge($request->all(), ['userId' => $userId, 'code' => $code]) |
||
112 | ); |
||
113 | } catch (UserNotFoundException $e) { |
||
127 | } |
||
128 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.