From 8a993a62abc505f3505ce8431dc32b95490bafab Mon Sep 17 00:00:00 2001 From: Gregorio Chiko Putra Date: Fri, 24 May 2019 16:49:45 +0700 Subject: [PATCH 1/2] Fixed access log conflict --- app/Http/Controllers/SiswaController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/SiswaController.php b/app/Http/Controllers/SiswaController.php index 1fac937..ed85d37 100644 --- a/app/Http/Controllers/SiswaController.php +++ b/app/Http/Controllers/SiswaController.php @@ -47,8 +47,22 @@ class SiswaController extends Controller $siswa = Siswa::where('nisn', $request->nisn) ->where('tanggal_lahir', $tanggalLahir); - if ($request->with !== null) + if ($request->with !== null) { + if (is_array($request->with)) { + $relationships = []; + foreach ($request->with as $relation) { + if ($relation === 'accessLog') + $relationships[$relation] = function ($query) use ($request) { + $query->where('src', '=', $request->src); + }; + else + $relationships[$relation] = function ($query) { $query; }; + } + $request->with = $relationships; + } + $siswa = $siswa->with($request->with); + } $siswa = $siswa->first(); From 2c16e32a575b52f5b9f65cef6f9d792022d1b518 Mon Sep 17 00:00:00 2001 From: Gregorio Chiko Putra Date: Fri, 24 May 2019 16:50:15 +0700 Subject: [PATCH 2/2] Bumped version to v1.1.4 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index c4fbf20..5863a19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "smk-kelulusan", - "version": "1.1.3", + "version": "1.1.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index c9fd99f..6d543bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smk-kelulusan", - "version": "1.1.3", + "version": "1.1.4", "description": "", "main": "webpack.mix.js", "directories": {