Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
forbidals
/
admin_panel
/
app
/
Models
:
LeaveMaster.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Auth; use App\Traits\DateFormatTrait; class LeaveMaster extends Model { use HasFactory, DateFormatTrait; protected $fillable = ['leaves','holiday','session_year_id','school_id']; protected $hidden = ['created_at','updated_at']; public function scopeOwner() { if (Auth::user()) { return $this->where('school_id', Auth::user()->school_id); } } /** * Get the session_year that owns the LeaveMaster * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function session_year() { return $this->belongsTo(SessionYear::class); } /** * Get the school that owns the LeaveMaster * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function school() { return $this->belongsTo(School::class); } /** * Get all of the leave for the LeaveMaster * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function leave() { return $this->hasMany(Leave::class); } public function getCreatedAtAttribute() { return $this->formatDateValue($this->getRawOriginal('created_at')); } public function getUpdatedAtAttribute() { return $this->formatDateValue($this->getRawOriginal('updated_at')); } }