Argument 1 passed must be an instance of App\Request, instance of Illuminate\Http\Request given

Stefan Bogdanescu

Founder & Senior Architect · 2026-06-29

Laravel Company
Understanding Argument Passing in Laravel Models and Controllers Argument 1 passed must be an instance of App\Request, instance of Illuminate\Http\Request given - This error message suggests that you are passing a variable to your model method that is not of the expected type. In this scenario, both the App\User::storePoster() method and its call in UserController@poster require an instance of Illuminate\Http\Request as the first argument. Let's break down why this is happening and how you can correct it. You have created a method named storePoster() in your User model, which uses Intervention to handle uploaded files. You also have a corresponding method in your UserController that calls the static method from your user model. In order for this code to work as expected, both methods need to receive an object of type Illuminate\Http\Request. When you navigate to "/user-profile/store/poster", the controller is called and passes a Request object (instance of Illuminate\Http\Request) generated by Laravel's routing system. The problem arises when this instance is not being correctly passed on to your model method. This can happen if: 1. The Request object in your controller is not properly referenced with $request. For example, instead of using '$request' as the argument name in your controller, try replacing it with 'RequestObject'. 2. The type hinting for Illuminate\Http\Request in your model method is wrong or missing. Ensure that you have indicated the correct type hinting for your method signature in both the user model and controller methods. 3. The Request object passed from your controller is not an instance of Illuminate\Http\Request but instead an App\Request instance. In this case, you may want to ensure that you are passing a Request instance generated by Laravel's routing system (Illuminate\Http\Request). To fix the issue and avoid this error in the future, follow these steps: 1. Ensure that your method signatures in both the user model and controller match the required parameter types. In this case, it should be 'Request $request'. 2. Use type hinting correctly to ensure that only appropriate objects are passed as arguments. This helps Laravel's type system identify errors during runtime. 3. Ensure that you are passing the correct Request object from your controller and not a custom App\Request instance. Laravel provides an Illuminate\Http\Request instance from its routing system, which should be used in this case. 4. Use proper naming conventions for method names and variables to avoid confusion between the model and controller implementations of the same logic. It's always better to keep your code well-organized. This error message seems to indicate a miscommunication between your UserController and App\User methods, which might be because one or more of these issues are present in your codebase. To resolve this problem, you can follow the best practices mentioned above as well as ensure that both your controller and model methods are receiving and passing the appropriate Request objects. In doing so, you'll be able to execute the desired functionalities while adhering to Laravel's naming conventions and coding standards.