Files
eatvio-infra/app/Livewire/Recipe/Comment/Show.php
2024-01-09 13:25:22 +03:00

40 lines
961 B
PHP

<?php
namespace App\Livewire\Recipe\Comment;
use App\Models\Recipe;
use Livewire\Component;
use Illuminate\View\View;
class Show extends Component
{
public Recipe $recipe;
public array $tabpanelState = ['positive' => 'positive', 'negative' => false];
// protected $listeners = ['commentAdded' => '$refresh'];
public function render(): View
{
return view('livewire.recipe.comment.show');
}
protected function getListeners(): array
{
return ['commentAdded' => '$refresh'];
}
public function toggleTabpanelState(string $tabpanelName): void
{
collect($this->tabpanelState)->keys()->each(
function ($key) use ($tabpanelName) {
if ($key === $tabpanelName) {
$this->tabpanelState[$tabpanelName] = $tabpanelName;
} else {
$this->tabpanelState[$key] = false;
}
}
);
}
}