diff --git a/app/Http/Livewire/Projected.php b/app/Http/Livewire/Projected.php index bc95d48..bada99f 100644 --- a/app/Http/Livewire/Projected.php +++ b/app/Http/Livewire/Projected.php @@ -225,22 +225,24 @@ class Projected extends Component } } - public function updateRow() { + public function updateRow(): void + { $post = \App\Models\Post::whereHas('category', function ($query) { return $query->where('user_id', \Auth::user()->id); })->where("id", $this->rowPostID)->first(); + # edit name if ($post->name !== $this->rowName) { $post->update(['name' => $this->rowName]); $post->save(); } $value = null; - if($this->rowValue != null && trim($this->rowValue) != "" && is_numeric(trim($this->rowValue))) { - $value = floatval($this->rowValue); + if($this->rowValue !== null && trim($this->rowValue) !== "" && is_numeric(trim($this->rowValue))) { + $value = (float)$this->rowValue; } - if($post != null && $value !== null) { + if($post !== null && $value !== null) { for($m=1;$m<=12;$m++) { $post->setMonthValue($m, $value); } diff --git a/resources/views/livewire/projected.blade.php b/resources/views/livewire/projected.blade.php index b56416a..46d4570 100644 --- a/resources/views/livewire/projected.blade.php +++ b/resources/views/livewire/projected.blade.php @@ -223,12 +223,12 @@
- +

Set value for all months ({!!$rowTypeHTML!!})