source: app/Http/Controllers/OrganizerController.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.1 KB
Line 
1<?php
2
3namespace App\Http\Controllers;
4
5use App\Models\Manager;
6use App\Models\Organizer;
7use App\Models\Transaction;
8use App\Models\User;
9use Illuminate\Http\Request;
10use Illuminate\Support\Facades\Auth;
11
12class OrganizerController extends Controller
13{
14 //
15 public function __construct()
16 {
17 $this->middleware(['auth', 'verified', 'onboarding', 'role:organizer']);
18 }
19
20 /**
21 * Display the specified resource.
22 *
23 * @param int $id
24 * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\never
25 */
26 public function show($username)
27 {
28 $user = User::where('username', $username)->firstOrFail();
29
30 if (Auth::id() === $user->id) {
31 $organizerProfile = Organizer::with('user')
32 ->whereHas('user', function ($query) use ($username) {
33 return $query->where('username', '=', $username);
34 })->firstOrFail();
35
36 return view('web.organizer.profile')
37 ->with('organizer', $organizerProfile);
38 }
39
40 return abort(404);
41 }
42}
Note: See TracBrowser for help on using the repository browser.