refactor parse condition

This commit is contained in:
harshjagad20
2021-12-18 13:14:46 +05:30
parent 9652e3bdf5
commit 2765f35f98
6 changed files with 29 additions and 13 deletions

View File

@ -35,6 +35,8 @@ class Estimate extends Model implements HasMedia
'created_at',
'updated_at',
'deleted_at',
'estimate_date',
'expiry_date'
];
protected $appends = [
@ -57,14 +59,14 @@ class Estimate extends Model implements HasMedia
public function setEstimateDateAttribute($value)
{
if ($value) {
$this->attributes['estimate_date'] = Carbon::parse($value)->format('Y-m-d');
$this->attributes['estimate_date'] = $value;
}
}
public function setExpiryDateAttribute($value)
{
if ($value) {
$this->attributes['expiry_date'] = Carbon::parse($value)->format('Y-m-d');
$this->attributes['expiry_date'] = $value;
}
}