LD 5 年 前
コミット
b21b4eb46c
1 ファイル変更26 行追加0 行削除
  1. 26 0
      app/Services/LogService.php

+ 26 - 0
app/Services/LogService.php

@@ -0,0 +1,26 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\Log;
+use Illuminate\Support\Facades\Request;
+
+class LogService
+{
+    static public function log($method,$type,$description,$id_user=null){
+        if(!$id_user){
+            $id_user = '';
+            $user=auth()->user();
+            if($user) $id_user = $user['id'];
+        }
+        (new Log([
+            'operation'=>$method,
+            'type'=>$type,
+            'description'=>$description,
+            'id_user'=>$id_user,
+            'ip'=>Request::ip()
+        ]))->save();
+    }
+}