|
3 | 3 | @endphp |
4 | 4 | ## Do Things the Laravel Way |
5 | 5 |
|
6 | | -- Use `{{ $assist->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. |
7 | | -- If you're creating a generic PHP class, use `{{ $assist->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') }}`. |
8 | 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. |
9 | 9 |
|
10 | 10 | ### Database |
|
15 | 15 | - Use Laravel's query builder for very complex database operations. |
16 | 16 |
|
17 | 17 | ### Model Creation |
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->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') }}`. |
19 | 19 |
|
20 | 20 | ### APIs & Eloquent Resources |
21 | 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. |
|
39 | 39 | ### Testing |
40 | 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. |
41 | 41 | - Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`. |
42 | | -- When creating tests, make use of `{{ $assist->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. |
43 | 43 |
|
44 | 44 | ### Vite Error |
45 | | -@if ($assist->config->enforceSail) |
46 | | -- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `{{ $assist->composer() }} run dev` or ask the user to run it. |
| 45 | +@if ($assist->config->usesSail) |
| 46 | +- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `{{ $assist->composerCommand('run dev') }}` or ask the user to run it. |
47 | 47 | @else |
48 | | -- 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 `{{ $assist->composer() }} run dev`. |
| 48 | +- 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 `{{ $assist->composerCommand('run dev') }}`. |
49 | 49 | @endif |
0 commit comments