AspireCloud/app/Console/Commands/RouteTestCommand.php
Chuck Adams dddc897012
feat: rewrite plugin/theme downloads and asset urls to /download (#133)
* fix: use getenv() in UserSeeder, env() is broken there

* feat: rewrite download/version/screenshot/banner urls in plugins/themes

* feat: add AssetType::THEME_SCREENSHOT

* feat: add handy RouteTestCommand

* feat: rewrite icon urls
2025-01-18 08:14:50 -07:00

28 lines
786 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Route;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class RouteTestCommand extends Command
{
protected $signature = 'route:test {uri}';
protected $description = 'Match path against routes';
public function handle(): int
{
$uri = $this->argument('uri');
$router = Route::getRoutes();
$request = Request::create($uri);
try {
$route = $router->match($request);
$this->info("MATCH: {$route->uri} [{$route->getName()}]");
} catch (NotFoundHttpException) {
$this->fail("Route not found for $uri");
}
return 0;
}
}