Converts the $queryString property of a Livewire component to use the Url Attribute
use Livewire\Component;
class MyComponent extends Component
{
+ #[\Livewire\Attributes\Url]
public string $something = '';
+ #[\Livewire\Attributes\Url]
public string $another = '';
-
- protected $queryString = [
- 'something',
- 'another',
- ];
}
Configure your rector.php
:
<?php
use RectorLaravel\Rector\Class_\LivewireComponentQueryStringToUrlAttributeRector;
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withRules([
LivewireComponentQueryStringToUrlAttributeRector::class,
]);