You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -22,7 +22,6 @@ This application is a Laravel application and its main Laravel ecosystems packag
22
22
- alpinejs (ALPINEJS) - v3
23
23
- tailwindcss (TAILWINDCSS) - v4
24
24
25
-
26
25
## Conventions
27
26
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, naming.
28
27
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
- That being said, keys in an Enum should follow existing application Enum conventions.
115
114
116
115
117
-
=== filament/core rules ===
118
-
119
-
## Filament
120
-
- Filament is used by this application, check how and where to follow existing application conventions.
121
-
- Filament is a Server-Driven UI (SDUI) framework for Laravel. It allows developers to define user interfaces in PHP using structured configuration objects. It is built on top of Livewire, Alpine.js, and Tailwind CSS.
122
-
- You can use the `search-docs` tool to get information from the official Filament documentation when needed. This is very useful for Artisan command arguments, specific code examples, testing functionality, relationship management, and ensuring you're following idiomatic practices.
123
-
- Utilize static `make()` methods for consistent component initialization.
124
-
125
-
### Artisan
126
-
- You must use the Filament specific Artisan commands to create new files or components for Filament. You can find these with the `list-artisan-commands` tool, or with `php artisan` and the `--help` option.
127
-
- Inspect the required options, always pass `--no-interaction`, and valid arguments for other options when applicable.
128
-
129
-
### Filament's Core Features
130
-
- Actions: Handle doing something within the application, often with a button or link. Actions encapsulate the UI, the interactive modal window, and the logic that should be executed when the modal window is submitted. They can be used anywhere in the UI and are commonly used to perform one-time actions like deleting a record, sending an email, or updating data in the database based on modal form input.
131
-
- Forms: Dynamic forms rendered within other features, such as resources, action modals, table filters, and more.
132
-
- Infolists: Read-only lists of data.
133
-
- Notifications: Flash notifications displayed to users within the application.
134
-
- Panels: The top-level container in Filament that can include all other features like pages, resources, forms, tables, notifications, actions, infolists, and widgets.
135
-
- Resources: Static classes that are used to build CRUD interfaces for Eloquent models. Typically live in `app/Filament/Resources`.
136
-
- Schemas: Represent components that define the structure and behavior of the UI, such as forms, tables, or lists.
137
-
- Tables: Interactive tables with filtering, sorting, pagination, and more.
138
-
- Widgets: Small component included within dashboards, often used for displaying data in charts, tables, or as a stat.
139
-
140
-
### Relationships
141
-
- Determine if you can use the `relationship()` method on form components when you need `options` for a select, checkbox, repeater, or when building a `Fieldset`:
142
-
143
-
<code-snippetname="Relationship example for Form Select"lang="php">
144
-
Forms\Components\Select::make('user_id')
145
-
->label('Author')
146
-
->relationship('author')
147
-
->required(),
148
-
</code-snippet>
149
-
150
-
151
-
## Testing
152
-
- It's important to test Filament functionality for user satisfaction.
153
-
- Ensure that you are authenticated to access the application within the test.
154
-
- Filament uses Livewire, so start assertions with `livewire()` or `Livewire::test()`.
- The `deferFilters` method from Filament v3 is now the default behavior in Filament v4, so users must click a button before the filters are applied to the table. To disable this behavior, you can use the `deferFilters(false)` method.
207
-
- The `Grid`, `Section`, and `Fieldset` layout components no longer span all columns by default.
208
-
- The `all` pagination page method is not available for tables by default.
209
-
- All action classes extend `Filament\Actions\Action`. No action classes exist in `Filament\Tables\Actions`.
210
-
- The `Form` & `Infolist` layout components have been moved to `Filament\Schemas\Components`, for example `Grid`, `Section`, `Fieldset`, `Tabs`, `Wizard`, etc.
211
-
- A new `Repeater` component for Forms has been added.
212
-
- Icons now use the `Filament\Support\Icons\Heroicon` Enum by default. Other options are available and documented.
118
+
## Test Enforcement
213
119
214
-
### Organize Component Classes Structure
215
-
- Schema components: `Schemas/Components/`
216
-
- Table columns: `Tables/Columns/`
217
-
- Table filters: `Tables/Filters/`
218
-
- Actions: `Actions/`
120
+
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
121
+
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test` with a specific filename or filter.
219
122
220
123
221
124
=== laravel/core rules ===
222
125
223
126
## Do Things the Laravel Way
224
127
225
128
- 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.
226
-
- If you're creating a generic PHP class, use `artisan make:class`.
129
+
- If you're creating a generic PHP class, use `php artisan make:class`.
227
130
- 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.
- 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.
260
163
- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.
261
-
- 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.
164
+
- 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.
262
165
263
166
### Vite Error
264
167
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.
@@ -374,12 +277,11 @@ document.addEventListener('livewire:init', function () {
374
277
=== pest/core rules ===
375
278
376
279
## Pest
377
-
378
280
### Testing
379
281
- If you need to verify a feature is working, write or update a Unit / Feature test.
380
282
381
283
### Pest Tests
382
-
- All tests must be written using Pest. Use `php artisan make:test --pest <name>`.
284
+
- All tests must be written using Pest. Use `php artisan make:test --pest {name}`.
383
285
- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files - these are core to the application.
384
286
- Tests should test all of the happy paths, failure paths, and weird paths.
385
287
- Tests live in the `tests/Feature` and `tests/Unit` directories.
@@ -456,6 +358,13 @@ it('has emails', function (string $email) {
456
358
457
359
- Always use Tailwind CSS v4 - do not use the deprecated utilities.
458
360
- `corePlugins` is not supported in Tailwind v4.
361
+
- In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed.
362
+
<code-snippet name="Extending Theme in CSS" lang="css">
363
+
@theme {
364
+
--color-brand: oklch(0.72 0.11 178);
365
+
}
366
+
</code-snippet>
367
+
459
368
- In Tailwind v4, you import Tailwind using a regular CSS `@import` statement, not using the `@tailwind` directives used in v3:
0 commit comments