IMMREX7

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

<?php

namespace App;

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

class BusTransactionDetail extends Model
{
    protected $primaryKey = 'idBusTransactionDetail';
    protected $table = 'bus_transaction_details';
    protected $fillable = ['idBusTransaction', 'idStudent', 'idBusFeehead', '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(BusFeehead::class, 'idBusFeehead', 'idBusFeehead');
    }
}

Copyright © 2021 - 2025 IMMREX7