Follow the steps below to upgrade the package.
The signature of the following methods have changed. If you use those methods, you should report these changes in your code:
getBricks(?string $brickableClass = null): Collection
has been changed intogetBricks(?array $brickableClasses = []): Collection
.clearBricks(?string $brickableClass = null): void
has been changed intoclearBricks(?array $brickableClasses = []): void
.clearBricksExcept(string $brickableClass, Collection $excludeBricks): void
has been changed intoclearBricksExcept(Collection $excludeBricks): void
.
The following methods have been transferred from the Brickables
helper to the HasBrickablesTrait
. As so, you should update your code accordingly:
- In blade view,
{{ Brickables::displayBricks(HasBrickables $model, ?string $brickableClass = null) }}
should now be called as following:{!! $model->displayBricks(?array $brickableClasses) !!}
- In blade view,
{{ Brickables::displayAdminPanel(HasBrickables $model) }}
should now be called as following:{!! $model->displayAdminPanel() !!}
- In code,
Brickables::getAdditionableTo(HasBrickables $model)
should now be called as following:$model->getAdditionableBrickables()
- In code,
Brickables::getAll()
should now be called as following:$model->getRegisteredBrickables()
The following constraint keys have been renamed, make sure you report these changes:
'canOnlyHandle'
has been renamed in'can_only_handle'
'numberOfBricks'
has been renamed in'number_of_bricks'
Check how to benefit from the brand new brickables resources smart management.
To give package users more latitude to execute their own validation workflow, the way the brick inputs are validated has been updated.
As so, the mandatory brickables protected function setStoreValidationRules(): array
method does not exist anymore and has been replaced by the public function validateStoreInputs(): array
one.
Same story for the protected function setUpdateValidationRules(): array
, that has been replaced by the public function validateUpdateInputs(): array
one.
Make sure to update each brickable with these changes.
You will then be able to validate your form inputs as you wish with:
- Direct request validation:
return request()->validate([...])
- FormRequest validation
return app(BrickableStoreFormRequest::class)->validated()
- Custom validation workflow with validators: https://laravel.com/docs/validation#manually-creating-validators
See all change with the comparison tool.
If you see any forgotten and undocumented change, please submit a PR to add them to this upgrade guide.