app/Http/Controllers/Create_tripController.php
//admin can change the type of user
admin can change the type of user
admin can change the type of user
public function updateUser(Request $request , $id)                                
    {     
          $api_token=$request->api_token;
          $type=User::where('api_token','=',$api_token)->get('type');
          if($type=='admin')
          { 
          $user = User::findOrFail($id);
          $user->update($request->all());
          return response()->json($user,200);
          }
          return response()->json("YOU DON'T HAVE A PROPER PERMISSION",401 );
    }
public function updateUser ( Request $ request , $ id ) { $ api_token = $ request -> api_token ; $ type = User :: where ( 'api_token' , '=' , $ api_token ) -> get ( 'type' ) ; if ( $ type == 'admin' ) { $ user = User :: findOrFail ( $ id ) ; $ user -> update ( $ request -> all ( ) ) ; return response ( ) -> json ( $ user , 200 ) ; } return response ( ) -> json ( " YOU DON'T HAVE A PROPER PERMISSION " , 401 ) ; }
admin can change the type of user
admin can change the type of user