First Setup
Run following command from the directory you would like to start building Laravel application.
% curl -s "https://laravel.build/app_name" | bash
% cd app_name
Then, Sail script is also installed in the application directory. Sail helps to run artisan command in to application Docker containers. So, it is easier to include sail in the PATH environment variable.
%alias sail='sh $([ -f sail ] && echo sail || echo vendor/bin/sail)'
To make sure this is always available, you may add this to your shell configuration file in your home directory, such as ~/.zshrc or ~/.bashrc, and then restart your shell.
% sail up -d
% sail composer require laravel/breeze --dev
% sail artisan breeze:install
% sail artisan migrate
% npm install
% npm run dev
DB Tables and Models
Tables and models can be created with artisan commands as below.
% sail artisan make:model MyClass -m
% sail artisan migrate
% sail artisan migrate:rollback ## if needed to rollback one migration.
Authorization
authorization can be simplified with aids of middleware. Commands below show some of examples.
% sail artisan make:migration add_role_to_users_table
% sail artisan migrate
% sail artisan make:controller
% sail artisan make:middleware CheckUserRole
% sail artisan make:controller MyController --resource
% sail artisan route:list
When application needs to be developed by other machines or developers. It can be pushed to Git repository with .gitignore below.
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpactor.json
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode