diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php index 02024c8176..a0799f96c4 100644 --- a/app/Models/Loggable.php +++ b/app/Models/Loggable.php @@ -11,14 +11,26 @@ use Illuminate\Support\Facades\Auth; trait Loggable { + /** + * @author Daniel Meltzer morphMany(Actionlog::class, 'item'); } + /** + * @author Daniel Meltzer item_type = License::class; @@ -27,7 +39,9 @@ trait Loggable $log->item_type = static::class; $log->item_id = $this->id; } + $log->user_id = Auth::user()->id; + if (!is_null($this->asset_id) || isset($target)) { $log->target_type = Asset::class; $log->target_id = $this->asset_id; @@ -35,7 +49,8 @@ trait Loggable $log->target_type = User::class; $log->target_id = $this->assigned_to; } - $item =call_user_func(array($log->target_type, 'find'), $log->target_id); + + $item = call_user_func(array($log->target_type, 'find'), $log->target_id); $log->location_id = $item->location_id; $log->note = $note; $log->logaction('checkout'); @@ -43,6 +58,11 @@ trait Loggable return $log; } + /** + * @author Daniel Meltzer