Intro

If you didn’t already, follow the README.md file or Quickstart guide to setup the project requirements.

When using SQLite as your database, it’s recommended to have WAL enabled in config/database.php. It’s enabled by default. If you don’t want to use it, just comment out or delete the last 3 settings under connections.sqlite; busy_timeout, journal_mode and synchronous.

When you run migrate:fresh on existing SQL database with WAL enabled, your will probably get an error “General error: 11 database disk image is malformed”. After that, just run the command once more. This has been reported on offical Laravel GitHub.

If you don’t want to use Quick installation (which is recommended for your first project with ), follow these steps.

Database

Run database migrations

This command will create tables defined in database/migrations.

php artisan migrate

Generate dummy content

Run only after migrations.

database/seeders/DatabaseDemoSeeder.php

This command seeds the dummy demo data for you, so you can skip all other steps in this section.

php artisan app:demo
If you prefer to do data seeds manually, follow the steps below.

Seed core data

Run only after migrations.

This command will run seeders defined in database/seeders/DatabaseSeeder.php.

php artisan db:seed

Seed modules data

Run only after migrations.

This command will seed data for each enabled module defined in modules/{name}/database/seeders.

php artisan module:seed

You can create your own module seeders in database/seeders folder and then you don’t need to run this command. Or you can modify default seeders.

Refresh migrations and core data

This command will re-create all tables and seed new data for core application.
All previously saved data will be removed.

This will not generate modules tables, but not dummy data.
php artisan migrate:fresh --seed

Refresh migrations and all data

This command will re-create all tables and seed new data for core application and modules.
All previously saved data will be removed.

This will generate modules dummy data.
php artisan migrate:fresh --seed && php artisan module:seed -a
# Run this command when using sqlite database connection with WAL mode
php artisan migrate:fresh --seed && sleep 1 && php artisan module:seed -a

It’s recommended to define your own seeders for modules you will use and just run Laravel seeder command php artisan db:seed, instead of updating modules seeder files.

Enums

Every enum that comes with the boilerplate uses the app/Traits/HasEnumOptions.php trait which extends the enums with custom key-value options, options for select inputs and customized name.

For example, RoadmapType enum is using getDescriptiveName function to keep the enum names short, but provide more context when using it as part of your UI in options format.

$type = RoadmapType::Integration;

dd($type); // Integration
dd($type->getDescriptiveName()); // 3rd party integration

Get key-value options

Get options for select

$options = RoadmapType::forSelect();

// [
//   [
//     'label' => 'Feature request',
//     'value' => 'feature',
//   ],
//   [
//     'label' => '3rd party integration'
//     'value' => 'integration'
//   ],
//   [
//     'label' => 'Help request'
//     'value' => 'discussion'
//   ],
//   [
//     'label' => 'Bug fix request'
//     'value' => 'bug'
//   ],
// ]

Get name

Observers

Full docs coming soon…

Optimization

Run this command to cache your config, events, routes and views (NOTE: highly recommended for non-local environments):

php artisan optimize

Run this to remove cache:

php artisan optimize:clear

Code formatting

uses Laravel Pint for code formatting.

If you prefer to follow same code style then run this command (NOTE: this will modify all your files):

./vendor/bin/pint

To inspect for style errors without making any changes, run this command:

./vendor/bin/pint --test

To modify only uncommited changes according to Git, run this command:

./vendor/bin/pint --dirty

To modify only specific directories or files, run this command (this will modify only files in Models folder or User.php file, depends which one you run):

./vendor/bin/pint app/Models

./vendor/bin/pint app/Models/User.php

For more detailed usage of the plugin, please visit the official docs.

Debugbar

comes with Debugbar for Laravel so you can debug your application easier and faster.

Use the Debugbar only in development.

It is disabled by default. To enable it set DEBUGBAR_ENABLED to true in your .env.

Debugging

If your application running on Nginx fails to run with same or similar error “upstream sent too big header while reading response header from upstream”, add this to your Ngnix configuration file:

location ~ \.php$ {
  # your config here...

  # Fixes too big header from upstream
  fastcgi_buffers 16 16k;
  fastcgi_buffer_size 32k;
}