ok

Mini Shell

Direktori : /home2/selectio/public_html/fms-worksuite/app/Observers/
Upload File :
Current File : /home2/selectio/public_html/fms-worksuite/app/Observers/AttendanceObserver.php

<?php

namespace App\Observers;

use App\Models\Attendance;
use App\Events\ClockInEvent;

class AttendanceObserver
{

    public function saving(Attendance $attendance)
    {
        if (user()) {
            $attendance->last_updated_by = user()->id;
        }


    }

    public function creating(Attendance $attendance)
    {
        if (user()) {
            $attendance->added_by = user()->id;
        }

        $attendance->company_id = $attendance->user->company_id;
    }

    public function created(Attendance $attendance)
    {
        event(new ClockInEvent($attendance));
    }

}

Zerion Mini Shell 1.0