IMMREX7

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

<?php

namespace App;

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

class HostelAttendance extends Model
{
    protected $primaryKey = 'ID';
    protected $table = 'hostel_attendance';
    protected $fillable = ['Device_ID', 'Enrollment_Number', 'TimeStamp','status','idType','idMonth','date'];
    protected $dates = [
        'TimeStamp',
    ];

    public function setDateAttribute($date) {
        if (strlen($date) > 0)
            $this->attributes['date'] = Carbon::parse($date)->format('Y-m-d');
        else
            $this->attributes['date'] = null;
    }

    public function getDateAttribute($date) {
        // dd($date);
        if ($date && $date != '0000-00-00' && $date != 'null')
            return Carbon::parse($date)->format('d-m-Y');
        return '';
    }
}

Copyright © 2021 - 2025 IMMREX7