IMMREX7
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class LibraryTransaction extends Model
{
protected $primaryKey = 'idLibraryTransaction';
protected $table = 'library_transaction';
protected $fillable = ['receiptNo','idFinancialYear','memberType','bookStatus','idBook','amountPaid','paymentMode','paymentDate','status','remarks', 'idSchool'];
public function setPaymentDateAttribute($date) {
if (strlen($date) > 0)
$this->attributes['paymentDate'] = Carbon::createFromFormat('d-m-Y', $date);
else
$this->attributes['paymentDate'] = null;
}
public function getPaymentDateAttribute($date) {
if ($date && $date != '0000-00-00' && $date != 'null')
return Carbon::parse($date)->format('d-m-Y');
return '';
}
}
Copyright © 2021 -