File manager - Edit - /var/www/payraty/inventory_main/app/Traits/CreatedUpdatedBy.php
Back
<?php namespace App\Traits; use App\Models\User; trait CreatedUpdatedBy { /** * boot * * @return void */ public static function boot() { parent::boot(); static::creating(function ($model) { $model->fill([ 'created_by' => auth()->id() ?: User::query()->first(['id'])->id, 'updated_by' => auth()->id() ?: User::query()->first(['id'])->id, 'created_at' => now(), 'updated_at' => now(), ]); }); static::updating(function ($model) { $model->fill([ 'updated_by' => auth()->id() ?: User::query()->first(['id'])->id, 'updated_at' => now(), ]); }); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0.49 |
proxy
|
phpinfo
|
Settings