Skip to content

Commit

Permalink
Fix deferred loading
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-de-wit committed Jan 24, 2025
1 parent 2d1853e commit 9af27ce
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/Providers/LaravelIdeHelperHookPaperclipServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,29 @@
class LaravelIdeHelperHookPaperclipServiceProvider extends ServiceProvider implements DeferrableProvider
{
/**
* @return list<class-string<Command>>
* @var string
*/
const ModelsCommandAlias = 'laravel-ide-helper-hook-paperclip-command-alias';

/**
* @return list<class-string<Command>|string>
*/
public function provides(): array
{
return [
ModelsCommand::class,
static::ModelsCommandAlias,
];
}

public function boot(): void
{
// Laravel only allows a single deferred service provider to claim
// responsibility for a given class, interface, or service in the
// provides() method. To ensure this provider is properly loaded
// when running the ModelsCommand we bind an alias and use that instead.
$this->app->alias(ModelsCommand::class, static::ModelsCommandAlias);
}

public function register(): void
{
$this->registerIdeHelperHook();
Expand Down

0 comments on commit 9af27ce

Please sign in to comment.