argument('name')); } /** * Get the root namespace for the class. */ protected function rootNamespace(): string { return rtrim($this->laravel->getNamespace(), '\\'); } /** * The namespace of the plugin itself. * * @return string */ protected function pluginNamespace() { return sprintf("%s\%s", $this->rootNamespace(), $this->studlyName()); } /** * Build the directory for the class if necessary. */ protected function makeDirectory(string $path): string { if (! $this->files->isDirectory(dirname($path))) { $this->files->makeDirectory(dirname($path), 0777, true, true); } return $path; } /** * The path to the plugin directory. */ protected function pluginPath(): string { $name = Str::replaceFirst($this->rootNamespace(), '', $this->getNameInput()); return $this->laravel['path.base'].'/plugins/'.str_replace('\\', '/', Str::studly($name)); } /** * Check if plugin exists on a given path. * * @param string $pluginPath */ protected function pluginExists($pluginPath): bool { return $this->files->exists($pluginPath); } /** * Name of the plugin in StudlyCase format. */ protected function studlyName(): string { return Str::studly($this->getNameInput()); } /** * Name of the plugin in snake-case format. */ protected function snakeName(): string { return Str::snake($this->getNameInput(), '-'); } }