v11.28.0
browner12
tagged this
11 Oct 15:12
* allow guessing of nested component sometimes components will be part of a larger component grouping, and you may wish to group those components in a folder. as a simple example we'll use the classic "Card" component, which may be organized as such: - `App\View\Components\Card\Card` - `App\View\Components\Card\Header` - `App\View\Components\Card\Body` to utilize these in your Blade file you would: ```blade <x-card.card> <x-card.header>Title</x-card.header> <x-card.body>lorem ipsum</x-card.body> </x-card.card> ``` while this is fine, it doesn't read as nice as it could. with this commit, we can now omit the trailing duplicated word, as long as the class name matches the folder name. ```blade <x-card> <x-card.header>Title</x-card.header> <x-card.body>lorem ipsum</x-card.body> </x-card> ``` we do something similar with [Anonymous components](https://laravel.com/docs/11.x/blade#anonymous-index-components) * minor formatting * add test for nested default component parsing * minor formatting * allow using folder name for anonymous index components per @taylorotwell s request, allow users to name their root components with `index.blade.php` OR the name of the component folder. * fix tests the code changes add an extra `exists()` call, so we'll adjust our numbers here. * add some tests these are copy/paste adjustments of the existing "index" tests.