Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -0,0 +1,23 @@
<?php
namespace Spatie\LaravelIgnition\Exceptions;
use Spatie\Ignition\Contracts\BaseSolution;
use Spatie\Ignition\Contracts\ProvidesSolution;
use Spatie\Ignition\Contracts\Solution;
use Symfony\Component\HttpKernel\Exception\HttpException;
class CannotExecuteSolutionForNonLocalIp extends HttpException implements ProvidesSolution
{
public static function make(): self
{
return new self(403, 'Solutions cannot be run from your current IP address.');
}
public function getSolution(): Solution
{
return BaseSolution::create()
->setSolutionTitle('Checking your environment settings')
->setSolutionDescription("Solutions can only be executed by requests from a local IP address. Keep in mind that `APP_DEBUG` should set to false on any production environment.");
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Spatie\LaravelIgnition\Exceptions;
use Exception;
use Monolog\Logger;
use Spatie\Ignition\Contracts\BaseSolution;
use Spatie\Ignition\Contracts\ProvidesSolution;
use Spatie\Ignition\Contracts\Solution;
class InvalidConfig extends Exception implements ProvidesSolution
{
public static function invalidLogLevel(string $logLevel): self
{
return new self("Invalid log level `{$logLevel}` specified.");
}
public function getSolution(): Solution
{
$validLogLevels = array_map(
fn (string $level) => strtolower($level),
array_keys(Logger::getLevels())
);
$validLogLevelsString = implode(',', $validLogLevels);
return BaseSolution::create()
->setSolutionTitle('You provided an invalid log level')
->setSolutionDescription("Please change the log level in your `config/logging.php` file. Valid log levels are {$validLogLevelsString}.");
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace Spatie\LaravelIgnition\Exceptions;
use ErrorException;
use Spatie\FlareClient\Contracts\ProvidesFlareContext;
use Spatie\LaravelIgnition\Recorders\DumpRecorder\HtmlDumper;
class ViewException extends ErrorException implements ProvidesFlareContext
{
/** @var array<string, mixed> */
protected array $viewData = [];
protected string $view = '';
/**
* @param array<string, mixed> $data
*
* @return void
*/
public function setViewData(array $data): void
{
$this->viewData = $data;
}
/** @return array<string, mixed> */
public function getViewData(): array
{
return $this->viewData;
}
public function setView(string $path): void
{
$this->view = $path;
}
protected function dumpViewData(mixed $variable): string
{
return (new HtmlDumper())->dumpVariable($variable);
}
/** @return array<string, mixed> */
public function context(): array
{
$context = [
'view' => [
'view' => $this->view,
],
];
$context['view']['data'] = array_map([$this, 'dumpViewData'], $this->viewData);
return $context;
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Spatie\LaravelIgnition\Exceptions;
use Spatie\Ignition\Contracts\ProvidesSolution;
use Spatie\Ignition\Contracts\Solution;
class ViewExceptionWithSolution extends ViewException implements ProvidesSolution
{
protected Solution $solution;
public function setSolution(Solution $solution): void
{
$this->solution = $solution;
}
public function getSolution(): Solution
{
return $this->solution;
}
}