From 2355833d48d31060bc98308b47cb4df6297a6de5 Mon Sep 17 00:00:00 2001 From: Jason Xie Date: Tue, 14 Apr 2020 05:39:12 +0800 Subject: [PATCH 1/4] Update SupportSingleRecordNavigationLinks.php --- .../SupportSingleRecordNavigationLinks.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Traits/SupportSingleRecordNavigationLinks.php b/src/Traits/SupportSingleRecordNavigationLinks.php index c02048f..829c321 100644 --- a/src/Traits/SupportSingleRecordNavigationLinks.php +++ b/src/Traits/SupportSingleRecordNavigationLinks.php @@ -1,9 +1,14 @@ route('resourceId') === (int) self::singleRecordId()), AuthorizationException::class); + parent::authorizeTo($request, $ability); + } } From dffc780203d5650594c09d875a47a0ccbb356743 Mon Sep 17 00:00:00 2001 From: Jason Xie Date: Tue, 14 Apr 2020 05:44:56 +0800 Subject: [PATCH 2/4] Update SupportSingleRecordNavigationLinks.php change self to static --- src/Traits/SupportSingleRecordNavigationLinks.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Traits/SupportSingleRecordNavigationLinks.php b/src/Traits/SupportSingleRecordNavigationLinks.php index 829c321..fe3d2d4 100644 --- a/src/Traits/SupportSingleRecordNavigationLinks.php +++ b/src/Traits/SupportSingleRecordNavigationLinks.php @@ -33,7 +33,7 @@ public static function singleRecordId() */ public function authorizeTo(Request $request, $ability) { - throw_unless(((int) $request->route('resourceId') === (int) self::singleRecordId()), AuthorizationException::class); + throw_unless(((int) $request->route('resourceId') === (int) static::singleRecordId()), AuthorizationException::class); parent::authorizeTo($request, $ability); } } From 7d016c535f0b81e37f7e63e5cd7d51e8e5579b54 Mon Sep 17 00:00:00 2001 From: Jason Xie Date: Tue, 14 Apr 2020 05:45:16 +0800 Subject: [PATCH 3/4] Update SupportSingleRecordNavigationLinks.php --- src/Traits/SupportSingleRecordNavigationLinks.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Traits/SupportSingleRecordNavigationLinks.php b/src/Traits/SupportSingleRecordNavigationLinks.php index fe3d2d4..e29b531 100644 --- a/src/Traits/SupportSingleRecordNavigationLinks.php +++ b/src/Traits/SupportSingleRecordNavigationLinks.php @@ -1,6 +1,7 @@ Date: Tue, 14 Apr 2020 05:57:51 +0800 Subject: [PATCH 4/4] Update SupportSingleRecordNavigationLinks.php --- src/Traits/SupportSingleRecordNavigationLinks.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Traits/SupportSingleRecordNavigationLinks.php b/src/Traits/SupportSingleRecordNavigationLinks.php index e29b531..dc6651f 100644 --- a/src/Traits/SupportSingleRecordNavigationLinks.php +++ b/src/Traits/SupportSingleRecordNavigationLinks.php @@ -34,7 +34,9 @@ public static function singleRecordId() */ public function authorizeTo(Request $request, $ability) { - throw_unless(((int) $request->route('resourceId') === (int) static::singleRecordId()), AuthorizationException::class); + if (static::singleRecord()) { + throw_unless(((int) $request->route('resourceId') === (int) static::singleRecordId()), AuthorizationException::class); + } parent::authorizeTo($request, $ability); } }