source: app/Http/Controllers/ProfileController.php@ dfae77e

Last change on this file since dfae77e was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 22 months ago
  • Initial commit;
  • Property mode set to 100644
File size: 992 bytes
Line 
1<?php
2
3namespace App\Http\Controllers;
4
5use App\Enum\UserType;
6use App\Models\User;
7use Illuminate\Http\Request;
8use Illuminate\Support\Facades\Auth;
9
10class 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.