Refactor BaseComponent to initialize route parameters in the boot method
This commit is contained in:
20
app/Livewire/BaseComponent.php
Normal file
20
app/Livewire/BaseComponent.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Livewire;
|
||||||
|
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
abstract class BaseComponent extends Component
|
||||||
|
{
|
||||||
|
public $parameters = [];
|
||||||
|
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->parameters = $this->getRouteParameters();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getRouteParameters()
|
||||||
|
{
|
||||||
|
return get_route_parameters();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user