From 5f8697507ad828ae932bd3c3ac59bd59057bd942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Mon, 1 Aug 2022 17:21:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20#20220801=20=E6=97=A5=E5=BF=97=E5=85=B3?= =?UTF-8?q?=E8=81=94=E6=93=8D=E4=BD=9C=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Log/LogsController.php | 1 + app/Models/Log.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/app/Http/Controllers/Log/LogsController.php b/app/Http/Controllers/Log/LogsController.php index 499b166..f0441f6 100644 --- a/app/Http/Controllers/Log/LogsController.php +++ b/app/Http/Controllers/Log/LogsController.php @@ -12,6 +12,7 @@ class LogsController extends Controller public function index(Request $request) { $res = Log::query() + ->with(['user:id,name']) ->filter() ->paginate(); diff --git a/app/Models/Log.php b/app/Models/Log.php index 763f164..2b09204 100644 --- a/app/Models/Log.php +++ b/app/Models/Log.php @@ -98,4 +98,9 @@ class Log extends Model return $this->save(); } + + public function user() + { + return $this->hasOne(User::class, 'id', 'user_id'); + } }