refactor code style and code review

This commit is contained in:
2024-01-15 01:11:19 +03:00
parent bc2c8df9af
commit 12e4b419ce
16 changed files with 39 additions and 40 deletions

View File

@@ -5,8 +5,8 @@ namespace App\Livewire;
use App\Models\Diary;
use App\Models\Meal;
use App\Models\Portion;
use Livewire\Component;
use Illuminate\View\View;
use Livewire\Component;
class MealForm extends Component
{
@@ -42,11 +42,6 @@ class MealForm extends Component
'portion' => 'required|min:1',
];
protected function getListeners(): array
{
return ['food-intake-updated' => '$refresh'];
}
public function mount(): void
{
$this->diary = Diary::find($this->diaryId);
@@ -190,6 +185,11 @@ class MealForm extends Component
$this->portions = array_values($filtered);
}
protected function getListeners(): array
{
return ['food-intake-updated' => '$refresh'];
}
private function addPortionIfItFilled(): void
{
if (mb_strlen($this->product_name) && $this->quantity && mb_strlen($this->portion)) {