From 258174cfb9d0f2e2ff3a731b3249a2e34787b4ae Mon Sep 17 00:00:00 2001 From: Hasnayeen Date: Thu, 18 Jul 2024 00:42:17 +0600 Subject: [PATCH] Update authorization check --- src/Page.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Page.php b/src/Page.php index a4eb354..298ca13 100644 --- a/src/Page.php +++ b/src/Page.php @@ -42,10 +42,15 @@ protected function authorize() return; } + + if (! Gate::getPolicyFor(static::$model)) { + return; + } + if (static::$model) { $action = request()->route()->getActionMethod(); $model = static::$model; - $record = request()->route($model::getRouteKeyName()); + $record = request()->route()->parameter(Str::kebab($model)); $policyMethod = $this->mapMethodToPolicy($action);