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'); + } }