diff --git a/app/Livewire/Diet/LikeCount.php b/app/Livewire/Diet/LikeCount.php index a377a77..81203ea 100644 --- a/app/Livewire/Diet/LikeCount.php +++ b/app/Livewire/Diet/LikeCount.php @@ -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 { diff --git a/app/Livewire/Plan/Comment/Show.php b/app/Livewire/Plan/Comment/Show.php index b742bfb..e3df6bd 100644 --- a/app/Livewire/Plan/Comment/Show.php +++ b/app/Livewire/Plan/Comment/Show.php @@ -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 { diff --git a/app/Livewire/Plan/LikeCount.php b/app/Livewire/Plan/LikeCount.php index 4691481..5679337 100755 --- a/app/Livewire/Plan/LikeCount.php +++ b/app/Livewire/Plan/LikeCount.php @@ -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 { diff --git a/app/Livewire/Recipe/Comment/Show.php b/app/Livewire/Recipe/Comment/Show.php index fabfe33..ebf5353 100644 --- a/app/Livewire/Recipe/Comment/Show.php +++ b/app/Livewire/Recipe/Comment/Show.php @@ -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( diff --git a/app/Livewire/Recipe/Create.php b/app/Livewire/Recipe/Create.php index 3ee389a..439d955 100644 --- a/app/Livewire/Recipe/Create.php +++ b/app/Livewire/Recipe/Create.php @@ -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 { diff --git a/app/Livewire/Recipe/Edit.php b/app/Livewire/Recipe/Edit.php index 8b84034..400da3b 100644 --- a/app/Livewire/Recipe/Edit.php +++ b/app/Livewire/Recipe/Edit.php @@ -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(); } diff --git a/app/Livewire/Recipe/LikeCount.php b/app/Livewire/Recipe/LikeCount.php index 001ce43..536a3e9 100644 --- a/app/Livewire/Recipe/LikeCount.php +++ b/app/Livewire/Recipe/LikeCount.php @@ -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 { diff --git a/tests/Feature/Plan/CreateTest.php b/tests/Feature/Plan/CreateTest.php index b96e8e1..be22484 100644 --- a/tests/Feature/Plan/CreateTest.php +++ b/tests/Feature/Plan/CreateTest.php @@ -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);