IMMREX7
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class StdfeeCheque extends Model {
protected $primaryKey = 'idStdCheque';
protected $table = 'stdfees_cheque';
protected $fillable = ['idSchool', 'idStudent','chequeBounceCharge','feeTotal','fine','excessAmount','penaltyAmount','penaltyRemarks','discount' ,'idFinancialYear', 'chequeNo', 'paymentMode', 'chequeDate', 'idBank', 'paymentDate', 'amount'];
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 '';
}
public function setChequeDateAttribute($date) {
if (strlen($date) > 0)
$this->attributes['chequeDate'] = Carbon::createFromFormat('d-m-Y', $date);
else
$this->attributes['chequeDate'] = null;
}
public function getChequeDateAttribute($date) {
if ($date && $date != '0000-00-00' && $date != 'null')
return Carbon::parse($date)->format('d-m-Y');
return '';
}
public function bank() {
return $this->belongsTo(Bank::class, 'idBank', 'idBank');
}
}
Copyright © 2021 -