diff --git a/src/Commands/Crud/Command.php b/src/Commands/Crud/Command.php index d289061..f8a02ee 100644 --- a/src/Commands/Crud/Command.php +++ b/src/Commands/Crud/Command.php @@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; -use function Illuminate\Events\queueable; class Command extends BaseCommand { @@ -30,11 +29,11 @@ protected function checkRelations($package, $relations) foreach ($relations as $type => $rels) { foreach ($rels as $rel) { - if(Namespaces::get($rel['method'])) { + if (Namespaces::get($rel['method'])) { continue; } - if (!class_exists("\\".$this->getNamespace($package)."\\Models\\".$rel['model'])) { + if (! class_exists('\\'.$this->getNamespace($package).'\\Models\\'.$rel['model'])) { question: $msg = sprintf('Input the namespace for the model %s', $rel['model']); $ns = $this->ask($msg, 'App\Models'); diff --git a/src/Commands/Crud/Namespaces.php b/src/Commands/Crud/Namespaces.php index 2e1002b..b36ff12 100644 --- a/src/Commands/Crud/Namespaces.php +++ b/src/Commands/Crud/Namespaces.php @@ -12,7 +12,7 @@ public static function register($name, $namespace) { self::$namespaces = Cache::get('namespaces', self::$namespaces); - if(! isset(self::$namespaces[$name])) { + if (! isset(self::$namespaces[$name])) { self::$namespaces[$name] = $namespace; Cache::put('namespaces', self::$namespaces, 3600); } @@ -21,6 +21,7 @@ public static function register($name, $namespace) public static function get($name = null) { $namespaces = Cache::get('namespaces', self::$namespaces); + return isset($name) ? ($namespaces[$name] ?? false) : $namespaces; } -} \ No newline at end of file +} diff --git a/src/Commands/CrudPackage.php b/src/Commands/CrudPackage.php index 3c0b57d..bfce9f4 100644 --- a/src/Commands/CrudPackage.php +++ b/src/Commands/CrudPackage.php @@ -69,6 +69,7 @@ public function handle() foreach ($tables as $k => $table) { if (! in_array($table, $inDb)) { $this->error("Table \"$table\" is not in the current database, maybe you have to run \"php artisan migrate\""); + return; } @@ -135,7 +136,7 @@ private function checkModel($model) { $ns = Namespaces::get($model); - if($ns) { + if ($ns) { return $ns; }