Refactor BaseComponent to initialize route parameters in the boot method
This commit is contained in:
parent
6220172f70
commit
a6259d8a52
1 changed files with 20 additions and 0 deletions
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();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue