File: /www/wwwroot/www.shooperm.com/Modules/Attendance/Entities/Event.php
<?php
namespace Modules\Attendance\Entities;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
class Event extends Model
{
protected $fillable = ['title','for_whom','location','description','from_date','to_date','image','status','created_by','updated_by'];
public function scopeActive($query)
{
return $query->where('status',1);
}
public static function boot()
{
parent::boot();
static::created(function ($model) {
$model->created_by = Auth::id() ?? null;
});
static::updating(function ($model) {
$model->updated_by = Auth::id() ?? null;
});
}
}