generated from JeRabix/moonshine-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: error page for ignition less version
- Loading branch information
Showing
4 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
src/Ignition/BeforeIgnitionRefactor/IconNotFoundSolution.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace JeRabix\MoonshineIconify\Ignition\BeforeIgnitionRefactor; | ||
|
||
use Illuminate\Support\Facades\Artisan; | ||
use JeRabix\MoonshineIconify\Commands\DownloadIconifyIconsCommand; | ||
use Spatie\Ignition\Contracts\RunnableSolution; | ||
|
||
|
||
class IconNotFoundSolution implements RunnableSolution | ||
{ | ||
|
||
public function getSolutionActionDescription(): string | ||
{ | ||
return 'Download usage iconify icons'; | ||
} | ||
|
||
public function getRunButtonText(): string | ||
{ | ||
return 'Download usage iconify icons'; | ||
} | ||
|
||
public function run(array $parameters = []): void | ||
{ | ||
Artisan::call(DownloadIconifyIconsCommand::class); | ||
} | ||
|
||
public function getRunParameters(): array | ||
{ | ||
return []; | ||
} | ||
|
||
public function getSolutionTitle(): string | ||
{ | ||
return 'Icon not found'; | ||
} | ||
|
||
public function getSolutionDescription(): string | ||
{ | ||
return 'Icon not found'; | ||
} | ||
|
||
public function getDocumentationLinks(): array | ||
{ | ||
return []; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/Ignition/BeforeIgnitionRefactor/IconNotFoundSolutionProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace JeRabix\MoonshineIconify\Ignition\BeforeIgnitionRefactor; | ||
|
||
use Illuminate\Support\Arr; | ||
use Spatie\Ignition\Contracts\HasSolutionsForThrowable; | ||
use Spatie\LaravelIgnition\Exceptions\ViewException; | ||
use Throwable; | ||
|
||
class IconNotFoundSolutionProvider implements HasSolutionsForThrowable | ||
{ | ||
|
||
public function canSolve(Throwable $throwable): bool | ||
{ | ||
if (!$throwable instanceof ViewException) { | ||
return false; | ||
} | ||
|
||
$viewPath = Arr::get($throwable->context(), 'view.view'); | ||
|
||
if (!$viewPath || $viewPath !== resource_path('views/vendor/moonshine/components/icon.blade.php')) { | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
public function getSolutions(Throwable $throwable): array | ||
{ | ||
return [ | ||
new IconNotFoundSolution() | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters