Laravel, dump startup without access to Shell

I have two controllers with the same name:

app\controllers\CareersController.php (for general use) app\controllers\Admin\CareersController.php (for admins)

Due to a name conflict, I added namespace admin; to the administrator controller.

Everything works fine locally, but when I downloaded the new administrator controller to my server, I get the error message: Class Admin\CareersController does not exist

As far as I understand, the fix: php artisan dump-autoload and composer dump-autoload

However, I do not have access to Shell to run these commands, and the composer on the server is still not installed. So, is there a way to reload an automatic download file without accessing Shell?

+5
source share
1 answer

You do not need shell access. Artisan includes the dump-autoload . You can only use this via a PHP call in your application:

 Route::get('/updateapp', function() { \Artisan::call('dump-autoload'); echo 'dump-autoload complete'; }); 

Edit: just noticed that you wrote: "Composer is not installed on the server." Not sure what will happen - try the above command and let us know.

If it does not work - then just run the dump-autoload link locally - then load the new autoload.php file.

As a side point - is there an option to switch servers? You will constantly face various problems if you do not have access to the command line and composer. You could just use Forge and deploy a new server to DigitalOcean, Linode, etc. In less time than it would take to fix this problem :)

+4
source

Source: https://habr.com/ru/post/1203655/


All Articles