Total Complexity | 9 |
Total Lines | 80 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | class ManagerController extends Controller |
||
13 | { |
||
14 | /** |
||
15 | * Class constructor. |
||
16 | */ |
||
17 | public function __construct() |
||
18 | { |
||
19 | // This applies the appropriate policy to each resource route. |
||
20 | $this->authorizeResource(Manager::class, 'manager'); |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Display a listing of the resource. |
||
25 | * |
||
26 | * @return \Illuminate\Http\Response |
||
1 ignored issue
–
show
|
|||
27 | */ |
||
28 | public function index() |
||
29 | { |
||
30 | // TODO: complete. |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Store a newly created resource in storage. |
||
35 | * |
||
36 | * @param \Illuminate\Http\Request $request Incoming Request. |
||
37 | * @return \Illuminate\Http\Response |
||
1 ignored issue
–
show
|
|||
38 | */ |
||
39 | public function store(Request $request) |
||
40 | { |
||
41 | // TODO: complete. |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Display the specified resource. |
||
46 | * |
||
47 | * @param \App\Models\Manager $manager Incoming Manager. |
||
48 | * @return \Illuminate\Http\Response |
||
49 | */ |
||
50 | public function show(Manager $manager) |
||
51 | { |
||
52 | return new JsonResource($manager); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Display the Manager for the current logged in user. |
||
57 | * |
||
58 | * @return \Illuminate\Http\Response |
||
59 | */ |
||
60 | public function showAuthenticated() |
||
61 | { |
||
62 | $user = Auth::user(); |
||
63 | if ($user !== null && $user->manager !== null) { |
||
64 | return new JsonResource($user->manager); |
||
65 | } |
||
66 | return response()->json([]); |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Update the specified resource in storage. |
||
71 | * |
||
72 | * @param \App\Http\Requests\UpdateManagerApi $request Incoming Form Request. |
||
73 | * @param \App\Models\Manager $manager Incoming Manager. |
||
74 | * @return \Illuminate\Http\Response |
||
75 | */ |
||
76 | public function update(UpdateManagerApi $request, Manager $manager) |
||
77 | { |
||
78 | $validated = $request->validated(); |
||
79 | $manager->fill($validated); |
||
80 | $manager->save(); |
||
81 | return new JsonResource($manager); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * Remove the specified resource from storage. |
||
86 | * |
||
87 | * @param \App\Models\Manager $manager Incoming Manager. |
||
88 | * @return \Illuminate\Http\Response |
||
1 ignored issue
–
show
|
|||
89 | */ |
||
90 | public function destroy(Manager $manager) |
||
92 | // TODO: complete. |
||
93 | } |
||
94 | } |
||
95 |