Changed be able to edit names
This commit is contained in:
1 parent
072d54f46f
commit
a9cd16d987
3 files changed
+18
-9
No files matched your search
@@ -217,10 +217,10 @@ class Projected extends Component
|
||||
})->where("id", $id)->first();
|
||||
|
||||
if($post) {
|
||||
$this->rowPostID = $post->id;
|
||||
$this->rowName = $post->name;
|
||||
$this->rowTypeHTML = "<span class=\"".($post->is_expense ? "col-neg" : "col-pos")."\">".($post->is_expense ? "expense" : "income")."</span>";
|
||||
$this->modalRowUpdate = true;
|
||||
$this->rowPostID = $post->id;
|
||||
$this->rowName = $post->name;
|
||||
$this->rowTypeHTML = "<span class=\"".($post->is_expense ? "col-neg" : "col-pos")."\">".($post->is_expense ? "expense" : "income")."</span>";
|
||||
$this->modalRowUpdate = true;
|
||||
$this->emit("focusField", "rowValue");
|
||||
}
|
||||
}
|
||||
@@ -230,6 +230,11 @@ class Projected extends Component
|
||||
return $query->where('user_id', \Auth::user()->id);
|
||||
})->where("id", $this->rowPostID)->first();
|
||||
|
||||
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);
|
||||
|
||||
@@ -10,6 +10,7 @@ class Post extends Model
|
||||
use HasFactory;
|
||||
private $monthValueCache = null;
|
||||
private $monthActualValueCache = null;
|
||||
protected $guarded = [];
|
||||
|
||||
public function category() {
|
||||
return $this->belongsTo(\App\Models\Category::class);
|
||||
|
||||
Reference in new issue
Block a user