app/Http/Controllers/UserController.php
//update ur own profile or update by admin (but need restriction such that no one will be able to modify email as it is primary key and all depends on it, else need to care of redundancy)
update ur own profile or update by admin (but need restriction such that no one will be able to modify email as it is primary key and all depends on it, else need to care of redundancy)
update ur own profile or update by admin ( but need restriction such that no one will be able to modify email as it is primary key and all depends on it else need to care of redundancy )
public function updateUser(Request $request , $id)                                
    {     
          $api_token=$request->api_token;
          $type=User::where('api_token','=',$api_token)->value('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 ) -> value ( '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 ) ; }
update ur own profile or update by admin (but need restriction such that no one will be able to modify email as it is primary key and all depends on it, else need to care of redundancy)
update ur own profile or update by admin ( but need restriction such that no one will be able to modify email as it is primary key and all depends on it else need to care of redundancy )