uddate controller methods doc

pull/18/head
shihab 2 years ago
parent f4c80a7797
commit e0efb6a5d7

@ -44,7 +44,7 @@ class RoleController extends Controller {
* Display the specified resource. * Display the specified resource.
* *
* @param \App\Models\Role $role * @param \App\Models\Role $role
* @return \Illuminate\Http\Response * @return \App\Models\Role $role
*/ */
public function show(Role $role) { public function show(Role $role) {
return $role; return $role;
@ -55,7 +55,7 @@ class RoleController extends Controller {
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \App\Models\Role $role * @param \App\Models\Role $role
* @return \Illuminate\Http\Response * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response|Role
*/ */
public function update(Request $request, Role $role = null) { public function update(Request $request, Role $role = null) {

@ -17,7 +17,6 @@ class UserController extends Controller {
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function index() { public function index() {
//
return User::all(); return User::all();
} }
@ -85,7 +84,7 @@ class UserController extends Controller {
* Display the specified resource. * Display the specified resource.
* *
* @param \App\Models\User $user * @param \App\Models\User $user
* @return \Illuminate\Http\Response * @return \App\Models\User $user
*/ */
public function show(User $user) { public function show(User $user) {
return $user; return $user;
@ -94,9 +93,10 @@ class UserController extends Controller {
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \App\Models\User $user * @param \App\Models\User $user
* @return \Illuminate\Http\Response * @return User
* @throws MissingAbilityException
*/ */
public function update(Request $request, User $user) { public function update(Request $request, User $user) {
$user->name = $request->name ?? $user->name; $user->name = $request->name ?? $user->name;
@ -143,6 +143,12 @@ class UserController extends Controller {
return response(['error' => 0, 'message' => 'user deleted']); return response(['error' => 0, 'message' => 'user deleted']);
} }
/**
* Return Auth user
*
* @param Request $request
* @return mixed
*/
public function me(Request $request) { public function me(Request $request) {
return $request->user(); return $request->user();
} }

@ -11,7 +11,7 @@ class UserRoleController extends Controller {
* Display a listing of the resource. * Display a listing of the resource.
* *
* @param \App\Models\User $user * @param \App\Models\User $user
* @return \Illuminate\Http\Response * @return \App\Models\User $user
*/ */
public function index(User $user) { public function index(User $user) {
return $user->load('roles'); return $user->load('roles');
@ -22,7 +22,7 @@ class UserRoleController extends Controller {
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \App\Models\User $user * @param \App\Models\User $user
* @return \Illuminate\Http\Response * @return \App\Models\User $user
*/ */
public function store(Request $request, User $user) { public function store(Request $request, User $user) {
$data = $request->validate([ $data = $request->validate([
@ -41,7 +41,7 @@ class UserRoleController extends Controller {
* *
* @param \App\Models\User $user * @param \App\Models\User $user
* @param \App\Models\Role $role * @param \App\Models\Role $role
* @return \Illuminate\Http\Response * @return \App\Models\User $user
*/ */
public function destroy(User $user, Role $role) { public function destroy(User $user, Role $role) {
$user->roles()->detach($role); $user->roles()->detach($role);

Loading…
Cancel
Save