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

@ -28,7 +28,7 @@ class Payment extends Model implements HasMedia
public const PAYMENT_MODE_CREDIT_CARD = 'CREDIT_CARD';
public const PAYMENT_MODE_BANK_TRANSFER = 'BANK_TRANSFER';
protected $dates = ['created_at', 'updated_at'];
protected $dates = ['created_at', 'updated_at', 'payment_date'];
protected $guarded = ['id'];
@ -57,7 +57,7 @@ class Payment extends Model implements HasMedia
public function setPaymentDateAttribute($value)
{
if ($value) {
$this->attributes['payment_date'] = Carbon::parse($value)->format('Y-m-d');
$this->attributes['payment_date'] = $value;
}
}