/** * Handle the command. * * @param Filesystem $filesystem * @param Application $application * @return string */ public function handle(Filesystem $filesystem, Application $application) { $destination = $application->getResourcesPath('addons/' . $this->addon->getVendor() . '/' . $this->addon->getSlug() . '-' . $this->addon->getType() . '/views'); if (is_dir($destination) && !$this->command->option('force')) { $this->command->error("{$destination} already exists."); return; } $filesystem->copyDirectory($this->addon->getPath('resources/views'), $destination); $this->command->info("Published {$destination}"); }
/** * Handle the command. * * @param Parser $parser * @param Filesystem $filesystem */ public function handle(Parser $parser, Filesystem $filesystem) { $suffix = ucfirst(camel_case($this->slug)); $segment = $this->slug; $addon = $this->addon->getSlug(); $controller = $this->addon->getTransformedClass("Http\\Controller\\Admin\\{$suffix}Controller"); $path = $this->addon->getPath("resources/routes/{$this->slug}.php"); $template = $filesystem->get(base_path("vendor/anomaly/streams-platform/resources/stubs/entity/http/routes.stub")); $filesystem->makeDirectory(dirname($path), 0755, true, true); $filesystem->put($path, $parser->parse($template, compact('addon', 'segment', 'controller'))); }
/** * Return the migration's contextual namespace. * * @return string */ public function contextualNamespace() { return $this->getNamespace() ?: $this->addon->getSlug(); }
/** * Register the service provider for an addon. * * @param Addon $addon */ public function register(Addon $addon) { if ($addon instanceof Module && !$addon->isEnabled() && $addon->getSlug() !== 'installer') { return; } if ($addon instanceof Extension && !$addon->isEnabled()) { return; } $provider = $addon->getServiceProvider(); if (!class_exists($provider)) { return; } $this->providers[] = $provider = $addon->newServiceProvider(); $this->bindAliases($provider); $this->bindClasses($provider); $this->bindSingletons($provider); $this->registerRoutes($provider, $addon); $this->registerOverrides($provider, $addon); $this->registerEvents($provider); $this->registerPlugins($provider); $this->registerCommands($provider); $this->registerSchedules($provider); $this->registerProviders($provider); $this->registerMiddleware($provider); $this->registerRouteMiddleware($provider); if (method_exists($provider, 'register')) { $this->application->call([$provider, 'register']); } }