If you are seeing this exception in your Laravel application:
BadMethodCallException Method [find] does not exist
Firstly, you might want to check if you are accessing methods that do not exist in the object. If that is not the case, there are a few other possibilities.
The class you are calling is not the same one you need, to check and validate, check the
use statements at the beginning of the file. For example, if you want to use the
User class from Eloquent, the
use statement should be the one as shown below:
Sometimes, there's is something wrong with autoloading, you can run the command below to refresh the composer's autoloading:
It happens when you try to edit Laravel's core code base. In this case, you will want to re-download the Laravel Vendor Code.
Firstly, you delete the Laravel code:
rm -rf vendor/laravel
Then reinstall it again by running the command below:
We have covered all the possible reasons for the
BadMethodCall exception in Laravel. Hope you find it useful.