1 | <?php namespace App\Http\Controllers; |
||
7 | class UsersController extends Controller |
||
8 | { |
||
9 | /** |
||
10 | * Create a new authentication controller instance. |
||
11 | */ |
||
12 | 15 | public function __construct() |
|
16 | |||
17 | /** |
||
18 | * Show the form for creating a new resource. |
||
19 | * |
||
20 | * @param \Illuminate\Http\Request $request |
||
21 | * |
||
22 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||
23 | */ |
||
24 | 6 | public function create(Request $request) |
|
32 | |||
33 | /** |
||
34 | * Store a newly created user. |
||
35 | * |
||
36 | * @param \Illuminate\Http\Request $request * |
||
37 | * @param \App\Contracts\Registrar $registrar |
||
38 | * |
||
39 | * @return \Illuminate\Http\RedirectResponse|\Symfony\Component\HttpFoundation\Response |
||
40 | */ |
||
41 | 4 | public function store(Request $request, Registrar $registrar) |
|
51 | |||
52 | /** |
||
53 | * Display the specified user information. |
||
54 | * |
||
55 | * @param \App\Contracts\Registrar $registrar |
||
56 | * @param int $id |
||
57 | * |
||
58 | * @return \Illuminate\Http\JsonResponse |
||
59 | */ |
||
60 | 2 | public function show(Registrar $registrar, $id) |
|
61 | { |
||
62 | 2 | $user = $registrar->get($id); |
|
63 | |||
64 | 2 | return response()->json(['message' => 'Found', 'data' => $user]); |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * Show the form for editing user information. |
||
69 | * |
||
70 | * @param \Illuminate\Http\Request $request |
||
71 | * @param \App\Contracts\Registrar $registrar |
||
72 | * @param int $id |
||
73 | * |
||
74 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View |
||
75 | */ |
||
76 | 1 | public function edit(Request $request, Registrar $registrar, $id) |
|
87 | |||
88 | /** |
||
89 | * Update the specified user information. |
||
90 | * |
||
91 | * @param \Illuminate\Http\Request $request |
||
92 | * @param \App\Contracts\Registrar $registrar |
||
93 | * @param int $id |
||
94 | * |
||
95 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse |
||
96 | */ |
||
97 | 2 | public function update(Request $request, Registrar $registrar, $id) |
|
106 | |||
107 | /** |
||
108 | * Remove the specified user record from storage. |
||
109 | * |
||
110 | * @param \Illuminate\Http\Request $request |
||
111 | * @param \App\Contracts\Registrar $registrar |
||
112 | * @param int $id |
||
113 | * |
||
114 | * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse |
||
115 | */ |
||
116 | 2 | public function destroy(Request $request, Registrar $registrar, $id) |
|
126 | |||
127 | /** |
||
128 | * Get the post register / login redirect path. |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | 1 | private function redirectPath() |
|
140 | } |
||
141 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: