2.x - databases

This commit is contained in:
Saeed Vaziry
2024-09-29 00:30:04 +02:00
parent 32993025de
commit e4fed24498
62 changed files with 802 additions and 237 deletions

View File

@ -0,0 +1,38 @@
<?php
namespace App\Web\Traits;
use Illuminate\View\ComponentAttributeBag;
trait HasWidgets
{
protected ?string $live = '5s';
protected array $extraAttributes = [];
protected function getExtraAttributes(): array
{
$attributes = $this->extraAttributes;
if ($this->getLive()) {
$attributes['wire:poll.'.$this->getLive()] = '$dispatch(\'$refresh\')';
}
return $attributes;
}
public function getExtraAttributesBag(): ComponentAttributeBag
{
return new ComponentAttributeBag($this->getExtraAttributes());
}
public function getLive(): ?string
{
return $this->live;
}
public function getWidgets(): array
{
return [];
}
}