source: app/Http/Controllers/ProfileController.php

Last change on this file was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 2 years ago
  • Initial commit;
  • Property mode set to 100644
File size: 992 bytes
RevLine 
[dfae77e]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.