Development
Setup your application
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
.
Generate dummy content
database/seeders/DatabaseDemoSeeder.php
This command seeds the dummy demo data for you, so you can skip all other steps in this section.
Seed core data
This command will run seeders defined in database/seeders/DatabaseSeeder.php
.
Seed modules data
This command will seed data for each enabled module defined in modules/{name}/database/seeders
.
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.
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.
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.
Get key-value options
Get options for select
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):
Run this to remove cache:
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):
To inspect for style errors without making any changes, run this command:
To modify only uncommited changes according to Git, run this command:
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):
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.
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: