IMMREX7
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Carbon\Carbon;
class LesserTransactionDetail extends Model {
protected $primaryKey = 'idLessTransactionDet';
protected $table = 'lesser_transaction_details';
protected $fillable = ['idLesserTransaction', 'idStudent','paymentDate' ,'idFeehead', 'amountPaid', 'discount', 'fine', 'status'];
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 feehead() {
return $this->belongsTo(FeeHead::class, 'idFeehead', 'idFeehead');
}
public function north_feehead() {
return $this->belongsTo(NorthFeeHead::class, 'idFeehead', 'idFeehead');
}
}
Copyright © 2021 -