IMMREX7

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

<?php

namespace App;

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

class HostelTransactionDetail extends Model
{
    protected $primaryKey = 'idHostelTransactionDetail';
    protected $table = 'hostel_transaction_details';
    protected $fillable = ['idHostelTransaction', 'idStudent', 'idFeehead', 'amountPaid', 'discount', 'fine','status','paymentDate'];

    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(NorthFeeHead::class, 'idFeehead', 'idFeehead');
    }
    
    public function feehead_normal() {
        return $this->belongsTo(HostelFeehead::class, 'idFeehead', 'idHostelFeehead');
    }
}

Copyright © 2021 - 2025 IMMREX7