Skip to content

Commit

Permalink
Merge pull request #10913 from filamentphp/fix/configure-using-octane
Browse files Browse the repository at this point in the history
fix: configureUsing() Octane
  • Loading branch information
danharrin authored Jan 18, 2024
2 parents 261202d + 24d2c16 commit 58b586c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/support/src/Components/ComponentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ final public function __construct()
{
}

public static function isResolved(): bool
{
return app()->resolved(static::class);
}

public static function register(): void
{
app()->scopedIf(
Expand Down
14 changes: 14 additions & 0 deletions packages/support/src/Concerns/Configurable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ trait Configurable
{
public static function configureUsing(Closure $modifyUsing, ?Closure $during = null, bool $isImportant = false): mixed
{
if (! ($during || ComponentManager::isResolved())) {
app()->resolving(
ComponentManager::class,
fn (ComponentManager $manager) => $manager->configureUsing(
static::class,
$modifyUsing,
$during,
$isImportant,
),
);

return null;
}

return ComponentManager::resolve()->configureUsing(
static::class,
$modifyUsing,
Expand Down

0 comments on commit 58b586c

Please sign in to comment.