Last change
on this file since dfae77e was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 2 years ago |
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Http\Controllers\Auth;
|
---|
4 |
|
---|
5 | use App\Enum\UserType;
|
---|
6 | use App\Http\Controllers\Controller;
|
---|
7 | use App\Providers\RouteServiceProvider;
|
---|
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 | /*
|
---|
15 | |--------------------------------------------------------------------------
|
---|
16 | | Login Controller
|
---|
17 | |--------------------------------------------------------------------------
|
---|
18 | |
|
---|
19 | | This controller handles authenticating users for the application and
|
---|
20 | | redirecting them to your home screen. The controller uses a trait
|
---|
21 | | to conveniently provide its functionality to your applications.
|
---|
22 | |
|
---|
23 | */
|
---|
24 |
|
---|
25 | use AuthenticatesUsers;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Where to redirect users after login.
|
---|
29 | *
|
---|
30 | * @var string
|
---|
31 | */
|
---|
32 | public function redirectTo(): string
|
---|
33 | {
|
---|
34 | return match (Auth::user()->type) {
|
---|
35 | UserType::ARTIST->value => RouteServiceProvider::ARTIST_HOME,
|
---|
36 | UserType::ORGANIZER->value => RouteServiceProvider::ORGANIZER_HOME,
|
---|
37 | UserType::MANAGER->value => RouteServiceProvider::MANAGER_HOME,
|
---|
38 | default => RouteServiceProvider::HOME,
|
---|
39 | };
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Create a new controller instance.
|
---|
44 | *
|
---|
45 | * @return void
|
---|
46 | */
|
---|
47 | public function __construct()
|
---|
48 | {
|
---|
49 | $this->middleware('guest')->except('logout');
|
---|
50 | }
|
---|
51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.