fix parse condition

This commit is contained in:
harshjagad20
2021-12-18 12:43:20 +05:30
parent f5c4f66165
commit 9652e3bdf5
6 changed files with 8 additions and 8 deletions

View File

@ -25,7 +25,7 @@ class CustomField extends Model
public function setDateAnswerAttribute($value)
{
if ($value && $value != null) {
$this->attributes['date_answer'] = Carbon::createFromFormat('Y-m-d', $value);
$this->attributes['date_answer'] = Carbon::parse($value)->format('Y-m-d');
}
}

View File

@ -21,7 +21,7 @@ class CustomFieldValue extends Model
public function setDateAnswerAttribute($value)
{
if ($value && $value != null) {
$this->attributes['date_answer'] = Carbon::createFromFormat('Y-m-d', $value);
$this->attributes['date_answer'] = Carbon::parse($value)->format('Y-m-d');
}
}

View File

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

View File

@ -33,7 +33,7 @@ class Expense extends Model implements HasMedia
public function setExpenseDateAttribute($value)
{
if ($value) {
$this->attributes['expense_date'] = Carbon::createFromFormat('Y-m-d', $value);
$this->attributes['expense_date'] = Carbon::parse($value)->format('Y-m-d');
}
}

View File

@ -64,14 +64,14 @@ class Invoice extends Model implements HasMedia
public function setInvoiceDateAttribute($value)
{
if ($value) {
$this->attributes['invoice_date'] = Carbon::createFromFormat('Y-m-d', $value);
$this->attributes['invoice_date'] = Carbon::parse($value)->format('Y-m-d');
}
}
public function setDueDateAttribute($value)
{
if ($value) {
$this->attributes['due_date'] = Carbon::createFromFormat('Y-m-d', $value);
$this->attributes['due_date'] = Carbon::parse($value)->format('Y-m-d');
}
}

View File

@ -57,7 +57,7 @@ class Payment extends Model implements HasMedia
public function setPaymentDateAttribute($value)
{
if ($value) {
$this->attributes['payment_date'] = Carbon::createFromFormat('Y-m-d', $value);
$this->attributes['payment_date'] = Carbon::parse($value)->format('Y-m-d');
}
}