app/Http/Controllers/UserController.php
//delete ur own account or deletion by admin (take email as primary key, else need to handle redundancy)
delete ur own account or deletion by admin (take email as primary key, else need to handle redundancy)
delete ur own account or deletion by admin ( take email as primary key else need to handle redundancy )
public function deleteUser(Request $request , $id)       
    {    
         $api_token=$request->api_token;
         $type=User::where('api_token','=',$api_token)->value('type');
         if($type=='admin')
         {
         User::findOrFail($id)->delete();
         return response('Deleted Successfully',200);
         }
         return response()->json("YOU DON'T HAVE A PROPER PERMISSION",401);
    }
public function deleteUser ( Request $ request , $ id ) { $ api_token = $ request -> api_token ; $ type = User :: where ( 'api_token' , '=' , $ api_token ) -> value ( 'type' ) ; if ( $ type == 'admin' ) { User :: findOrFail ( $ id ) -> delete ( ) ; return response ( 'Deleted Successfully' , 200 ) ; } return response ( ) -> json ( " YOU DON'T HAVE A PROPER PERMISSION " , 401 ) ; }
delete ur own account or deletion by admin (take email as primary key, else need to handle redundancy)
delete ur own account or deletion by admin ( take email as primary key else need to handle redundancy )