From 55268cd47ac760e31dfcc2dc70db4ef9b87a72a0 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Wed, 8 Jan 2025 11:00:41 +0100 Subject: [PATCH] Catch meta, tweak auth (#1654) * Catch meta, tweak auth * composer fix-style * Catch meta, tweak auth --------- Co-authored-by: laravel-ide-helper --- src/Console/MetaCommand.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Console/MetaCommand.php b/src/Console/MetaCommand.php index e34270e..92f781d 100644 --- a/src/Console/MetaCommand.php +++ b/src/Console/MetaCommand.php @@ -233,7 +233,12 @@ class MetaCommand extends Command ], [ 'class' => ['\Illuminate\Support\Facades\Route', '\Illuminate\Support\Facades\Auth', 'Illuminate\Foundation\Auth\Access\Authorizable'], - 'method' => ['can', 'cannot'], + 'method' => ['can', 'cannot', 'cant'], + 'argumentSet' => 'auth', + ], + [ + 'class' => ['Illuminate\Contracts\Auth\Access\Authorizable'], + 'method' => ['can'], 'argumentSet' => 'auth', ], [ @@ -308,7 +313,13 @@ class MetaCommand extends Command { if (!isset($this->templateCache[$name])) { $file = __DIR__ . '/../../php-templates/' . basename($name) . '.php'; - $value = $this->files->requireOnce($file) ?: []; + try { + $value = $this->files->requireOnce($file) ?: []; + } catch (\Throwable $e) { + $value = []; + $this->warn('Cannot load template for ' . $name . ': ' . $e->getMessage()); + } + if (!$value instanceof Collection) { $value = collect($value); }