IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/app/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/app/HostelFeehead.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\Traits;
use Carbon\Carbon;

class HostelFeehead extends Model
{
    use Traits\AutoUpdateUserColumns;

    protected $primaryKey = 'idHostelFeehead';
    protected $table = 'hostel_feeheads';
    protected $fillable = ['idClass', 'idFinancialYear','idStudent' ,'idSection','studentCategory','flatFine','description' ,'feeheadName', 'amount', 'fromDate', 'toDate', 'fine', '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');
    }
}

Copyright © 2021 - 2025 IMMREX7