Last change
on this file since dfae77e was dfae77e, checked in by Igor Danilovski <igor_danilovski@…>, 2 years ago |
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | <?php
|
---|
2 |
|
---|
3 | namespace App\Http\Controllers;
|
---|
4 |
|
---|
5 | use App\Models\Artist;
|
---|
6 | use App\Models\Manager;
|
---|
7 | use App\Models\Offer;
|
---|
8 | use App\Models\User;
|
---|
9 | use Illuminate\Http\Request;
|
---|
10 | use Illuminate\Support\Facades\Auth;
|
---|
11 |
|
---|
12 | class ManagerController extends Controller
|
---|
13 | {
|
---|
14 | public function __construct()
|
---|
15 | {
|
---|
16 | $this->middleware(['auth', 'verified', 'onboarding', 'role:manager']);
|
---|
17 | }
|
---|
18 |
|
---|
19 | public function index()
|
---|
20 | {
|
---|
21 | $artists = Artist::where('manager_id', Auth::id())->get();
|
---|
22 |
|
---|
23 | return view('web.manager.artists')
|
---|
24 | ->with('artists', $artists);
|
---|
25 | }
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Display the specified resource.
|
---|
29 | *
|
---|
30 | * @param int $id
|
---|
31 | * @return Responsе|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\never
|
---|
32 | */
|
---|
33 | public function show($username)
|
---|
34 | {
|
---|
35 | $user = User::where('username', $username)->firstOrFail();
|
---|
36 |
|
---|
37 | if (Auth::id() === $user->id) {
|
---|
38 | $managerProfile = Manager::with('user')
|
---|
39 | ->whereHas('user', function ($query) use ($username) {
|
---|
40 | return $query->where('username', '=', $username);
|
---|
41 | })->firstOrFail();
|
---|
42 |
|
---|
43 | return view('web.manager.profile')
|
---|
44 | ->with('manager', $managerProfile);
|
---|
45 | }
|
---|
46 |
|
---|
47 | return abort(404);
|
---|
48 | }
|
---|
49 |
|
---|
50 |
|
---|
51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.