Skip to content

Commit

Permalink
Fix capsule route registration order.
Browse files Browse the repository at this point in the history
  • Loading branch information
haringsrob committed Mar 4, 2022
1 parent c47f054 commit e3c4760
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 52 deletions.
41 changes: 0 additions & 41 deletions src/PackageServiceProvider.php

This file was deleted.

4 changes: 1 addition & 3 deletions src/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
33 changes: 33 additions & 0 deletions src/TwillPackageServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}
4 changes: 3 additions & 1 deletion src/TwillRoutes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/TwillServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -67,8 +66,6 @@ class TwillServiceProvider extends ServiceProvider
CapsulesServiceProvider::class,
];

private $migrationsCounter = 0;

/**
* Bootstraps the package services.
*
Expand Down Expand Up @@ -330,7 +327,7 @@ private function registerCommands(): void
Dev::class,
SyncLang::class,
CapsuleInstall::class,
GeneratePackageCommand::class
GeneratePackageCommand::class,
]);
}

Expand Down

0 comments on commit e3c4760

Please sign in to comment.