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.
*
* @param \App\Models\Role $role
* @return \Illuminate\Http\Response
* @return \App\Models\Role $role
*/
public function show(Role $role) {
return $role;
@ -55,7 +55,7 @@ class RoleController extends Controller {
*
* @param \Illuminate\Http\Request $request
* @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) {

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

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

Loading…
Cancel
Save