source: app/Http/Controllers/Auth/LoginController.php@ dfae77e

Last change on this file since dfae77e was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 2 years ago
  • Initial commit;
  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[dfae77e]1<?php
2
3namespace App\Http\Controllers\Auth;
4
5use App\Enum\UserType;
6use App\Http\Controllers\Controller;
7use App\Providers\RouteServiceProvider;
8use Illuminate\Foundation\Auth\AuthenticatesUsers;
9use Illuminate\Http\Request;
10use Illuminate\Support\Facades\Auth;
11
12class 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.