IMMREX7

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

<?php

namespace App;

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

class EmpAttendance extends Model {

    protected $primaryKey = 'ID';
    protected $table = 'employee_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::createFromFormat('d-m-Y', $date);
        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