laravel permissions in the serve code example

Example 1: proper permission webserver laravel

sudo chmod -R 777 path/to/root
sudo chown -R www-data:www-data /path/to/root
sudo usermod -a -G www-data ubuntu
sudo find /path/to/root -type f -exec chmod 644 {} \;
sudo find /path/to/root -type d -exec chmod 755 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

Example 2: laravel permission

//install laravel permission with composer installer for Laravel 6.0 or higher
composer require spatie/laravel-permission
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"

Tags:

Misc Example