|
| 1 | +@php |
| 2 | +/** @var \Laravel\Boost\Install\GuidelineAssist $assist */ |
| 3 | +@endphp |
1 | 4 | ## Do Things the Laravel Way |
2 | 5 |
|
3 | | -- Use `php artisan make:` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using the `list-artisan-commands` tool. |
4 | | -- If you're creating a generic PHP class, use `artisan make:class`. |
| 6 | +- Use `{{ $assist->artisanCommand('make:') }}` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using the `list-artisan-commands` tool. |
| 7 | +- If you're creating a generic PHP class, use `{{ $assist->artisanCommand('make:class') }}`. |
5 | 8 | - Pass `--no-interaction` to all Artisan commands to ensure they work without user input. You should also pass the correct `--options` to ensure correct behavior. |
6 | 9 |
|
7 | 10 | ### Database |
|
12 | 15 | - Use Laravel's query builder for very complex database operations. |
13 | 16 |
|
14 | 17 | ### Model Creation |
15 | | -- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using `list-artisan-commands` to check the available options to `php artisan make:model`. |
| 18 | +- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using `list-artisan-commands` to check the available options to `{{ $assist->artisanCommand('make:model') }}`. |
16 | 19 |
|
17 | 20 | ### APIs & Eloquent Resources |
18 | 21 | - For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not, then you should follow existing application convention. |
|
36 | 39 | ### Testing |
37 | 40 | - When creating models for tests, use the factories for the models. Check if the factory has custom states that can be used before manually setting up the model. |
38 | 41 | - Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`. |
39 | | -- When creating tests, make use of `php artisan make:test [options] <name>` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests. |
| 42 | +- When creating tests, make use of `{{ $assist->artisanCommand('make:test [options] {name}') }}` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests. |
40 | 43 |
|
41 | 44 | ### Vite Error |
42 | | -- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `{{ $assist->nodePackageManager() }} run build` or ask the user to run `{{ $assist->nodePackageManager() }} run dev` or `composer run dev`. |
| 45 | +- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `{{ $assist->nodePackageManagerCommand('run build') }}` or ask the user to run `{{ $assist->nodePackageManagerCommand('run dev') }}` or `{{ $assist->composerCommand('run dev') }}`. |
0 commit comments