Skip to content
Advertisement

Call to a member function store() on null Laravel 8

When I click on save to update the data on my edit page, I get the following error.

call to a member function store() on null

JavaScript

Advertisement

Answer

As a result of $request->file(‘file’) is returning null, and you are trying to call a method on null, resulting in the exception.

Due to the way Laravel handles PUT and PATCH requests, you will need to send your request in a POST request, and supply _method with the value PUT in the header. This is what Laravel expects.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement