fix permission

I prefer to own all the directories and files (it makes working with everything much easier), so I do:

## Webserver as owner (the way most people do it):

sudo chown -R www-data:www-data /path/to/your/laravel/root/directory

#Assuming `www-data` is your webserver user.
sudo usermod -a -G www-data ubuntu

sudo chown -R my-user:www-data /path/to/your/laravel/root/directory

#Then I give both myself and the webserver permissions:

sudo find /path/to/your/laravel/root/directory -type f -exec chmod 664 {} \; 

sudo find /path/to/your/laravel/root/directory -type d -exec chmod 775 {} \;

#Then give the webserver the rights to read and write to storage and cache
#Whichever way you set it up, then you need to give read and write permissions to the webserver for `storage`, `cache` and any other directories the webserver needs to upload or write too (depending on your situation), so run the commands from bashy above :

sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
#Source: https://stackoverflow.com/questions/30639174/file-permissions-for-laravel-5-and-others

laravel first installation

composer install --no-dev --prefer-source
npm install
npm run build
php artisan optimize:clear

laravel helpfull command

#migrate specific file
php artisan migrate:refresh --path=/database/migrations/fileName.php