Last change
on this file was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 2 years ago |
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[dfae77e] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Http\Controllers;
|
---|
| 4 |
|
---|
| 5 | use App\Models\Manager;
|
---|
| 6 | use App\Models\Organizer;
|
---|
| 7 | use App\Models\Transaction;
|
---|
| 8 | use App\Models\User;
|
---|
| 9 | use Illuminate\Http\Request;
|
---|
| 10 | use Illuminate\Support\Facades\Auth;
|
---|
| 11 |
|
---|
| 12 | class 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.