IMMREX7
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use App\Traits;
use Carbon\Carbon;
class NorthFeeHead extends Model {
//
use Traits\AutoUpdateUserColumns;
protected $primaryKey = 'idFeehead';
protected $table = 'northfeeheads';
protected $fillable = ['idClass', 'idFinancialYear', 'idStudent', 'idSection', 'studentCategory', 'fine', 'idType', 'demandName', 'idHeader', 'amount', 'fromDate', 'toDate', 'isParent', 'ecNO'];
public function setFromDateAttribute($date) {
if (strlen($date) > 0)
$this->attributes['fromDate'] = Carbon::createFromFormat('d-m-Y', $date);
else
$this->attributes['fromDate'] = null;
}
public function getFromDateAttribute($date) {
// dd($date);
if ($date && $date != '0000-00-00' && $date != 'null')
return Carbon::parse($date)->format('d-m-Y');
return '';
}
public function setToDateAttribute($date) {
if (strlen($date) > 0)
$this->attributes['toDate'] = Carbon::createFromFormat('d-m-Y', $date);
else
$this->attributes['toDate'] = null;
}
public function getToDateAttribute($date) {
if ($date && $date != '0000-00-00' && $date != 'null')
return Carbon::parse($date)->format('d-m-Y');
return '';
}
public function classM() {
return $this->belongsTo(ClassM::class, 'idClass', 'idClass');
}
public function section() {
return $this->belongsTo(Section::class, 'idSection', 'idSection');
}
public function student() {
return $this->belongsTo(AdmEntry::class, 'idStudent', 'idStudent');
}
public function header() {
return $this->belongsTo(Header::class, 'idHeader', 'idHeader');
}
}
Copyright © 2021 -