diff --git a/src/PackageServiceProvider.php b/src/PackageServiceProvider.php deleted file mode 100644 index d4749d8c3..000000000 --- a/src/PackageServiceProvider.php +++ /dev/null @@ -1,41 +0,0 @@ -publishes( - [$path => resource_path(config('twill.vendor_components_resource_path'))], - 'components' - ); - } - - protected function registerBlocksDirectory($path) - { - $blocks = Config::get('twill.block_editor.directories.source.blocks'); - - $blocks[] = [ - 'path' => $path, - 'source' => 'vendor', - ]; - - Config::set('twill.block_editor.directories.source.blocks', $blocks); - } - - protected function registerRepeatersDirectory($path) - { - $repeaters = Config::get('twill.block_editor.directories.source.repeaters'); - - $repeaters[] = [ - 'path' => $path, - 'source' => 'vendor', - ]; - - Config::set('twill.block_editor.directories.source.repeaters', $repeaters); - } -} diff --git a/src/RouteServiceProvider.php b/src/RouteServiceProvider.php index 96491e4d8..c2155be33 100644 --- a/src/RouteServiceProvider.php +++ b/src/RouteServiceProvider.php @@ -2,15 +2,13 @@ namespace A17\Twill; -use A17\Twill\Services\Capsules\Manager; use A17\Twill\Http\Controllers\Front\GlideController; +use A17\Twill\Http\Middleware\Authenticate; use A17\Twill\Http\Middleware\Impersonate; use A17\Twill\Http\Middleware\Localization; use A17\Twill\Http\Middleware\RedirectIfAuthenticated; use A17\Twill\Http\Middleware\SupportSubdomainRouting; use A17\Twill\Http\Middleware\ValidateBackHistory; -use A17\Twill\Http\Middleware\Authenticate; -use A17\Twill\Services\Routing\HasRoutes; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Routing\Router; use Illuminate\Support\Arr; diff --git a/src/TwillPackageServiceProvider.php b/src/TwillPackageServiceProvider.php index d9da7f646..f7a06afef 100644 --- a/src/TwillPackageServiceProvider.php +++ b/src/TwillPackageServiceProvider.php @@ -2,6 +2,7 @@ namespace A17\Twill; +use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Storage; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Str; @@ -68,4 +69,36 @@ protected function getPackageDirectory(): string return $path; } + + protected function registerVueComponentsDirectory($path) + { + $this->publishes( + [$path => resource_path(config('twill.vendor_components_resource_path'))], + 'components' + ); + } + + protected function registerBlocksDirectory($path) + { + $blocks = Config::get('twill.block_editor.directories.source.blocks'); + + $blocks[] = [ + 'path' => $path, + 'source' => 'vendor', + ]; + + Config::set('twill.block_editor.directories.source.blocks', $blocks); + } + + protected function registerRepeatersDirectory($path) + { + $repeaters = Config::get('twill.block_editor.directories.source.repeaters'); + + $repeaters[] = [ + 'path' => $path, + 'source' => 'vendor', + ]; + + Config::set('twill.block_editor.directories.source.repeaters', $repeaters); + } } diff --git a/src/TwillRoutes.php b/src/TwillRoutes.php index f2d5ab2f3..b1d5d7e77 100644 --- a/src/TwillRoutes.php +++ b/src/TwillRoutes.php @@ -122,7 +122,9 @@ public function registerCapsuleRoutes($router, Capsule $capsule): void $this->getRouteMiddleware(), $this->supportSubdomainRouting(), $capsule->getControllersNamespace(), - $capsule->getRoutesFile() + $capsule->getRoutesFile(), + // When it is not a package capsule we can register it immediately. + ! $capsule->packageCapsule ); } } diff --git a/src/TwillServiceProvider.php b/src/TwillServiceProvider.php index a37bc9d35..cf5df902e 100644 --- a/src/TwillServiceProvider.php +++ b/src/TwillServiceProvider.php @@ -2,20 +2,19 @@ namespace A17\Twill; -use A17\Twill\Commands\GeneratePackageCommand; -use A17\Twill\Commands\MakeSingletonCapsule; -use Exception; use A17\Twill\Commands\BlockMake; use A17\Twill\Commands\Build; use A17\Twill\Commands\CapsuleInstall; use A17\Twill\Commands\CreateSuperAdmin; use A17\Twill\Commands\Dev; use A17\Twill\Commands\GenerateBlocks; +use A17\Twill\Commands\GeneratePackageCommand; use A17\Twill\Commands\Install; use A17\Twill\Commands\ListBlocks; use A17\Twill\Commands\ListIcons; use A17\Twill\Commands\MakeCapsule; use A17\Twill\Commands\MakeSingleton; +use A17\Twill\Commands\MakeSingletonCapsule; use A17\Twill\Commands\ModuleMake; use A17\Twill\Commands\ModuleMakeDeprecated; use A17\Twill\Commands\RefreshCrops; @@ -35,11 +34,11 @@ use A17\Twill\Services\MediaLibrary\ImageService; use Astrotomic\Translatable\TranslatableServiceProvider; use Cartalyst\Tags\TagsServiceProvider; +use Exception; use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Foundation\AliasLoader; use Illuminate\Support\Facades\View; use Illuminate\Support\ServiceProvider; -use Illuminate\Support\Str; use PragmaRX\Google2FAQRCode\Google2FA as Google2FAQRCode; use Spatie\Activitylog\ActivitylogServiceProvider; @@ -67,8 +66,6 @@ class TwillServiceProvider extends ServiceProvider CapsulesServiceProvider::class, ]; - private $migrationsCounter = 0; - /** * Bootstraps the package services. * @@ -330,7 +327,7 @@ private function registerCommands(): void Dev::class, SyncLang::class, CapsuleInstall::class, - GeneratePackageCommand::class + GeneratePackageCommand::class, ]); }