app/Http/Controllers/RequestsController.php
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
Display a listing of the resource.
@return \Illuminate\Http\Response
Display a listing of the resource . @return \ Illuminate \ Http \ Response
public function index()
    {
        $requests = UserRequest::where('requested_user', auth()->id())->get();
        $user_list = [];
        if (request()["count"]){
            return response()->json(["count" => "returning count"], 200);
        }
        foreach($requests as $request){
            array_push($user_list, User::where('id', $request["user_id"])->get()[0]);
        }
        return response()->json($user_list, 200);
    }
public function index ( ) { $ requests = UserRequest :: where ( 'requested_user' , auth ( ) -> id ( ) ) -> get ( ) ; $ user_list = [ ] ; if ( request ( ) [ " count " ] ) { return response ( ) -> json ( [ " count " => " returning count " ] , 200 ) ; } foreach ( $ requests as $ request ) { array_push ( $ user_list , User :: where ( 'id' , $ request [ " user_id " ] ) -> get ( ) [ 0 ] ) ; } return response ( ) -> json ( $ user_list , 200 ) ; }
Display a listing of the resource.
Display a listing of the resource .
// Add total users to list // Get user returns array, get first find of array