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