added type to listeners

This commit is contained in:
2024-01-09 13:25:22 +03:00
parent fd33f95f25
commit 3bb04d9af4
8 changed files with 39 additions and 10 deletions

View File

@@ -10,7 +10,10 @@ class LikeCount extends Component
{
public Diet $diet;
protected $listeners = ['liked' => '$refresh'];
protected function getListeners(): array
{
return ['liked' => '$refresh'];
}
public function mount(Diet $diet): void
{

View File

@@ -12,7 +12,10 @@ class Show extends Component
public array $tabpanelState = ['positive' => 'positive', 'negative' => false];
protected $listeners = ['commentAdded' => '$refresh'];
protected function getListeners(): array
{
return ['commentAdded' => '$refresh'];
}
public function render(): View
{

View File

@@ -10,7 +10,10 @@ class LikeCount extends Component
{
public Plan $plan;
protected $listeners = ['liked-details' => '$refresh', 'liked-footer' => '$refresh'];
protected function getListeners(): array
{
return ['liked-details' => '$refresh', 'liked-footer' => '$refresh'];
}
public function mount(Plan $plan): void
{

View File

@@ -12,13 +12,18 @@ class Show extends Component
public array $tabpanelState = ['positive' => 'positive', 'negative' => false];
protected $listeners = ['commentAdded' => '$refresh'];
// 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(

View File

@@ -11,12 +11,15 @@ use Livewire\WithFileUploads;
use Illuminate\Database\Eloquent\Casts\AsCollection;
use Illuminate\View\View;
use Illuminate\Support\Collection;
use Illuminate\Http\UploadedFile;
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
class Create extends Component
{
use WithFileUploads;
public $image;
// public UploadedFile $image;
public $image;
public string $state = 'active';
@@ -48,7 +51,10 @@ class Create extends Component
public array $state_row = ['ingredient' => 'true', 'article' => 'false'];
protected $listeners = ['stepRemoved' => '$refresh'];
protected function getListeners(): array
{
return ['stepRemoved' => '$refresh'];
}
public function toggleStateRow(string $currentRow): void
{

View File

@@ -16,7 +16,7 @@ class Edit extends Component
public Recipe $recipe;
public $image;
public string $image;
public string $state = 'active';
@@ -48,7 +48,12 @@ class Edit extends Component
public array $state_row = ['ingredient' => 'true', 'article' => 'false'];
protected $listeners = ['stepRemoved' => '$refresh', 'parentComponentTagAdded', 'parentComponentTagRemoved'];
// protected $listeners = ['stepRemoved' => '$refresh', 'parentComponentTagAdded', 'parentComponentTagRemoved'];
protected function getListeners(): array
{
return ['stepRemoved' => '$refresh', 'parentComponentTagAdded', 'parentComponentTagRemoved'];
}
public function mount(Recipe $recipe): void
{
@@ -110,6 +115,7 @@ class Edit extends Component
);
$this->steps = array_values($newSteps);
$this->dispatch('stepRemoved')->self();
}

View File

@@ -10,7 +10,10 @@ class LikeCount extends Component
{
public Recipe $recipe;
protected $listeners = ['liked' => '$refresh'];
protected function getListeners(): array
{
return ['liked' => '$refresh'];
}
public function mount(Recipe $recipe): void
{

View File

@@ -76,7 +76,7 @@ class CreateTest extends TestCase
$lastCreatedPlan = Plan::orderBy('id', 'desc')->first();
$newPlanUrl = route('plan.show', $lastCreatedPlan, false);
$newPlanUrl = route('plan.show', $lastCreatedPlan);
$testCase->assertRedirect($newPlanUrl);