Skip to content

Commit

Permalink
fix: error page for ignition less version
Browse files Browse the repository at this point in the history
  • Loading branch information
JeRabix committed Sep 8, 2024
1 parent 4df0c61 commit df89636
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Providers/MoonshineIconifyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace JeRabix\MoonshineIconify\Providers;

use Composer\InstalledVersions;
use Illuminate\Support\ServiceProvider;
use JeRabix\MoonshineIconify\Commands\DownloadIconifyIconsCommand;
use JeRabix\MoonshineIconify\Enums\WorkingMode;
use JeRabix\MoonshineIconify\Ignition\IconNotFoundSolutionProvider;
use Spatie\ErrorSolutions\Contracts\SolutionProviderRepository as SolutionProviderRepositoryContract;

final class MoonshineIconifyServiceProvider extends ServiceProvider
{
Expand All @@ -24,10 +24,17 @@ public function boot(): void
'moonshine-iconify',
);

/** @var SolutionProviderRepositoryContract $rep */
$rep = app(SolutionProviderRepositoryContract::class);
if (InstalledVersions::isInstalled('spatie/laravel-ignition')) {
$spatieIgnitionVersion = InstalledVersions::getVersion('spatie/laravel-ignition');

$rep->registerSolutionProvider(IconNotFoundSolutionProvider::class);
if (version_compare($spatieIgnitionVersion, '2.8.0', '>=')) {
$rep = app(\Spatie\ErrorSolutions\SolutionProviderRepository::class);

$rep->registerSolutionProvider(IconNotFoundSolutionProvider::class);
} else {
// TODO: Add support error page for spatie/laravel-ignition < 2.8.0
}
}

if (config('moonshine-iconify.working_mode') === WorkingMode::ICONIFY_COMPONENT_MODE) {
moonshineAssets()->add([
Expand Down

0 comments on commit df89636

Please sign in to comment.