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);