Primo Committ
This commit is contained in:
42
vendor/facade/ignition/src/SolutionProviders/MissingLivewireComponentSolutionProvider.php
vendored
Normal file
42
vendor/facade/ignition/src/SolutionProviders/MissingLivewireComponentSolutionProvider.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Facade\Ignition\SolutionProviders;
|
||||
|
||||
use Facade\Ignition\Solutions\LivewireDiscoverSolution;
|
||||
use Facade\IgnitionContracts\HasSolutionsForThrowable;
|
||||
use Livewire\Exceptions\ComponentNotFoundException;
|
||||
use Livewire\LivewireComponentsFinder;
|
||||
use Throwable;
|
||||
|
||||
class MissingLivewireComponentSolutionProvider implements HasSolutionsForThrowable
|
||||
{
|
||||
public function canSolve(Throwable $throwable): bool
|
||||
{
|
||||
if (! $this->livewireIsInstalled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! $throwable instanceof ComponentNotFoundException) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getSolutions(Throwable $throwable): array
|
||||
{
|
||||
return [new LivewireDiscoverSolution('A Livewire component was not found')];
|
||||
}
|
||||
|
||||
public function livewireIsInstalled(): bool
|
||||
{
|
||||
if (! class_exists(ComponentNotFoundException::class)) {
|
||||
return false;
|
||||
}
|
||||
if (! class_exists(LivewireComponentsFinder::class)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user