Charlie Page
Search
K

Laravel

Permissions for Cache

sudo find storage/ -type f -exec chmod 664 {} \;
sudo find storage/ -type d -exec chmod 775 {} \;
sudo find bootstrap/cache/ -type f -exec chmod 664 {} \;
sudo find bootstrap/cache/ -type d -exec chmod 775 {} \;
sudo chown -R charlie:www-data storage
sudo chown -R charlie:www-data bootstrap/cache
sudo chmod -R ug+w storage
sudo chmod -R ug+w bootstrap/cache
sudo chmod g+s storage
sudo chmod g+s bootstrap/cache
php artisan cache:clear
composer dump-autoload
Other Option (might be best to combine)
setfacl -R -dm u:www-data:rwx storage
setfacl -R -m u:www-data:rwx storage
chmod -R g+w storage

Use below if you want identifier other than ID to be used with routing. (passing in User $user in a controller for example)

Route::bind('slug', function ($slug) {
return Pattern::whereSlug($slug)->firstOrFail();
});

With Notifications, class name CANNOT end in Notification. For example, ResetPasswordNotification (as of Laravel 5.4) will have issues when passing in objects via the constructor of the notification class.

Retry failed jobs

Replace 100 & 150 with the first ID of a failed job & the last ID of a failed job. (see php artisan queue:failed)
for ($i = 100; $i <= 150; $i ++) Artisan::call('queue:retry', ['id' => $i]);

Create Model with Migration

php artisan make:model Notes -m
Last modified 4yr ago