Last change
on this file was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 2 years ago |
|
-
Property mode
set to
100644
|
File size:
992 bytes
|
Rev | Line | |
---|
[dfae77e] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Http\Controllers;
|
---|
| 4 |
|
---|
| 5 | use App\Enum\UserType;
|
---|
| 6 | use App\Models\User;
|
---|
| 7 | use Illuminate\Http\Request;
|
---|
| 8 | use Illuminate\Support\Facades\Auth;
|
---|
| 9 |
|
---|
| 10 | class ProfileController extends Controller
|
---|
| 11 | {
|
---|
| 12 | public function __construct()
|
---|
| 13 | {
|
---|
| 14 |
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | /**
|
---|
| 18 | * Display the specified resource.
|
---|
| 19 | *
|
---|
| 20 | * @param int $id
|
---|
| 21 | * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\never|Response|Responsе
|
---|
| 22 | * @throws \Exception
|
---|
| 23 | */
|
---|
| 24 | public function show($username)
|
---|
| 25 | {
|
---|
| 26 | $user = User::where('username', $username)->firstOrFail();
|
---|
| 27 |
|
---|
| 28 | return match ($user->type) {
|
---|
| 29 | UserType::ARTIST->value => (new ArtistController())->show($username),
|
---|
| 30 | UserType::MANAGER->value => (new ManagerController())->show($username),
|
---|
| 31 | UserType::ORGANIZER->value => (new OrganizerController())->show($username),
|
---|
| 32 | default => throw new \Exception('Unexpected value'),
|
---|
| 33 | };
|
---|
| 34 | }
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.