Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
AuthenticationController | |
0.00% |
0 / 7 |
|
0.00% |
0 / 3 |
20 | |
0.00% |
0 / 1 |
loginView | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
login | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
logout | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace App\Http\Controllers\Dashboard; |
4 | |
5 | use App\Http\Controllers\Controller; |
6 | use App\Http\Requests\users\login; |
7 | use Illuminate\Http\Request; |
8 | use Illuminate\Support\Facades\Auth; |
9 | |
10 | class AuthenticationController extends Controller |
11 | { |
12 | public function loginView(){ |
13 | return view('Dashboard.login'); |
14 | } |
15 | |
16 | public function login(login $Request){ |
17 | $credentials = ['username' => $Request->username, 'password' => $Request->password]; |
18 | |
19 | if (Auth::guard('user')->attempt($credentials)) |
20 | return redirect()->intended('dashboard/login'); |
21 | |
22 | return redirect('dashboard')->with('error', trans('admin.username or password is wrong')); |
23 | } |
24 | |
25 | public function logout(){ |
26 | Auth::guard('user')->logout(); |
27 | |
28 | return redirect('dashboard/login'); |
29 | } |
30 | } |