create permission spatie laravel code example
Example 1: laravel folder permission
cd /path/to/root;
sudo chmod -R 777 ./
sudo chown -R www-data:www-data ./
sudo usermod -a -G www-data ubuntu
sudo find ./ -type f -exec chmod 644 {} \;
sudo find ./ -type d -exec chmod 755 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
Example 2: spatie/laravel-permission
composer require spatie/laravel-permission
'providers' => [
Spatie\Permission\PermissionServiceProvider::class,
];
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider"
php artisan optimize:clear
php artisan config:clear
php artisan migrate