File manager - Edit - /var/www/payraty/hris/app/Models/Leave.php
Back
<?php namespace App\Models; use Illuminate\Support\Facades\Auth; use App\Scopes\OrganisationScope; use Illuminate\Database\Eloquent\Model; class Leave extends Model { protected $fillable = [ 'employee_id', 'Leave_type_id', 'applied_on', 'start_date', 'end_date', 'total_leave_days', 'leave_reason', 'remark', 'status', 'created_by', 'organisation_id', ]; public function leaveType() { return $this->hasOne('App\Models\LeaveType', 'id', 'leave_type_id'); } public function employees() { return $this->hasOne('App\Models\Employee', 'id', 'employee_id'); } protected static function booted() { static::addGlobalScope(new OrganisationScope); static::creating(function ($model) { if (Auth::check()) { $model->organisation_id = Auth::user()->organisation_id; } }); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0.11 |
proxy
|
phpinfo
|
Settings