The site stopped working on the Laravel 5.6 framework, php artisan, composer commands do not work. An error is issued in all cases:

PHP Notice: Undefined variable: factory in /project/config/database/factories/UserFactory.php on line 16

In UserFactory.php line 16:

Call to a member function define () on null

I tried to update composer (composer update, composer self-update), reinstall the framework (composer install), start / stop the php artisan up / down application. The console still has the same error. In the browser when opening the site, it is the same:

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Call to a member function define () on null /project/config/database/factories/UserFactory.php

I would be very grateful for the informative answer!

  • just so broke chtoli? maybe you did something ... did not try to roll back? - Manitikyl 10:46 pm
  • Imagine just like that ... after the php artisan down command, the active mode no longer returns. What does it mean to roll back? How it's done? I have already tried laravel cache: clear, composer cache: clear is still the same error. There's something about the $ faker variable. She somehow null, judging by the error. - Artur Han
  • I believe that the links in the framework were broken. How to fix? - Artur Han
  • And show us this very 16th line! I think that there is nothing worth $ before the factory (), but I want to make sure. - Confireus

1 answer 1

Everything, found a problem. Accidentally through ftp somehow transferred the database folder to the config folder. It should not be there: / project / config / database / factories. I brought it back to the root of the application and it all worked!

  • We are always happy to help you! - Manitikyl