diff --git a/src/Illuminate/Database/Console/ShowModelCommand.php b/src/Illuminate/Database/Console/ShowModelCommand.php index 4075a3cf3d9d..8e9b5ac2177d 100644 --- a/src/Illuminate/Database/Console/ShowModelCommand.php +++ b/src/Illuminate/Database/Console/ShowModelCommand.php @@ -106,10 +106,9 @@ public function handle() */ protected function getPolicy($model) { - return collect(Gate::policies()) - ->filter(fn ($policy, $modelClass) => $modelClass === get_class($model)) - ->values() - ->first(); + $policy = Gate::getPolicyFor($model::class); + + return $policy ? $policy::class : null; } /**