Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 10 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
| LoginController | |
0.00% |
0 / 10 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| guard | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| showLoginForm | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| redirectTo | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| attemptLogin | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Controllers\Bo\Auth; |
| 4 | |
| 5 | use App\Http\Controllers\Controller; |
| 6 | use Illuminate\Contracts\Auth\StatefulGuard; |
| 7 | use Illuminate\Contracts\View\View; |
| 8 | use Illuminate\Foundation\Auth\AuthenticatesUsers; |
| 9 | use Illuminate\Http\Request; |
| 10 | use Illuminate\Support\Facades\Auth; |
| 11 | |
| 12 | class LoginController extends Controller |
| 13 | { |
| 14 | use AuthenticatesUsers; |
| 15 | |
| 16 | /** |
| 17 | * Create a new controller instance. |
| 18 | * |
| 19 | * @return void |
| 20 | */ |
| 21 | public function __construct() |
| 22 | { |
| 23 | $this->middleware('guest:backend')->except('logout'); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Get the guard to be used during authentication. |
| 28 | * |
| 29 | * @return \Illuminate\Contracts\Auth\StatefulGuard |
| 30 | */ |
| 31 | protected function guard(): StatefulGuard |
| 32 | { |
| 33 | return Auth::guard('backend'); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Show the application's login form. |
| 38 | * |
| 39 | * @return \Illuminate\Contracts\View\View |
| 40 | */ |
| 41 | public function showLoginForm(): View |
| 42 | { |
| 43 | return view('bo.auth.login'); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Where to redirect users after login. |
| 48 | * |
| 49 | * @return string |
| 50 | */ |
| 51 | protected function redirectTo(): string |
| 52 | { |
| 53 | return response()->redirectToIntended()->getTargetUrl(); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Attempt to log the user into the application. |
| 58 | * |
| 59 | * @param \Illuminate\Http\Request $request |
| 60 | * @return boolean |
| 61 | */ |
| 62 | protected function attemptLogin(Request $request) |
| 63 | { |
| 64 | $credentials = $this->credentials($request); |
| 65 | // * Attempt login only using published users. |
| 66 | $credentials['published'] = true; |
| 67 | return $this->guard()->attempt( |
| 68 | $credentials, |
| 69 | $request->boolean('remember') |
| 70 | ); |
| 71 | } |
| 72 | } |