IMMREX7
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\Traits;
class HostelFailedTransaction extends Model {
protected $primaryKey = 'idHostelFailedTransaction';
protected $table = 'hostel_failed_transaction';
protected $fillable = ['receiptNo', 'idSchool', 'idFinancialYear', 'paymentDate',
'fine', 'idStudent', 'paymentMode', 'discount', 'totalPaid', 'penaltyAmount',
'penaltyRemarks', 'remarks', 'cardNo', 'chequeBounceCharge', 'idBank', 'status', 'chequeNo', 'chequeDate'];
public function student() {
return $this->belongsTo(AdmEntry::class, 'idStudent', 'idStudent');
}
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 -