Files
eatvio-infra/app/Livewire/Recipe/LikeCount.php

28 lines
499 B
PHP

<?php
namespace App\Livewire\Recipe;
use App\Models\Recipe;
use Livewire\Component;
use Illuminate\View\View;
class LikeCount extends Component
{
public Recipe $recipe;
protected $listeners = ['liked' => '$refresh'];
public function mount(Recipe $recipe): void
{
$this->recipe = $recipe;
}
public function render(): View
{
return view(
'livewire.recipe.like-count',
['count' => $this->recipe->likes_count]
);
}
}