mirror of
https://github.com/filamentphp/filament.git
synced 2026-10-13 09:26:05 +08:00
issue
This commit is contained in:
@@ -1,62 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Commands;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class MakeIssueCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'make:filament-issue';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Generates a link to the Filament issue page and pre-fills the version numbers.';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$filament = InstalledVersions::getPrettyVersion('filament/filament');
|
||||
$laravel = InstalledVersions::getPrettyVersion('laravel/framework');
|
||||
$livewire = InstalledVersions::getPrettyVersion('livewire/livewire');
|
||||
$php = PHP_VERSION;
|
||||
|
||||
$issueTemplate = 'bug_report.yml';
|
||||
$baseGithubUrl = 'https://github.com/filamentphp/filament/issues/new?';
|
||||
|
||||
$queryParams = [
|
||||
'template' => $issueTemplate,
|
||||
'package-version' => $filament,
|
||||
'laravel-version' => $laravel,
|
||||
'livewire-version' => $livewire,
|
||||
'php-version' => $php,
|
||||
];
|
||||
|
||||
$fullUrl = "{$baseGithubUrl}" . http_build_query($queryParams);
|
||||
|
||||
$this->openGithubIssueInBrowser($fullUrl);
|
||||
}
|
||||
|
||||
public function openGithubIssueInBrowser(string $url): void
|
||||
{
|
||||
if (PHP_OS_FAMILY === 'Darwin') {
|
||||
exec('open "' . $url . '"');
|
||||
}
|
||||
if (PHP_OS_FAMILY === 'Linux') {
|
||||
exec('xdg-open "' . $url . '"');
|
||||
}
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
exec('start "" "' . $url . '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,6 @@ class FilamentServiceProvider extends PackageServiceProvider
|
||||
Commands\CacheComponentsCommand::class,
|
||||
Commands\ClearCachedComponentsCommand::class,
|
||||
Commands\MakeClusterCommand::class,
|
||||
Commands\MakeIssueCommand::class,
|
||||
Commands\MakePageCommand::class,
|
||||
Commands\MakePanelCommand::class,
|
||||
Commands\MakeRelationManagerCommand::class,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Commands\Aliases;
|
||||
namespace Filament\Support\Commands\Aliases;
|
||||
|
||||
use Filament\Commands;
|
||||
use Filament\Support\Commands;
|
||||
|
||||
class MakeIssueCommand extends Commands\MakeIssueCommand
|
||||
{
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Support\Commands;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class MakeIssueCommand extends Command
|
||||
{
|
||||
protected $signature = 'make:filament-issue';
|
||||
|
||||
protected $description = 'Generates a link to the Filament issue page and pre-fills the version numbers.';
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$this->openUrlInBrowser('https://github.com/filamentphp/filament/issues/new?' . http_build_query([
|
||||
'template' => 'bug_report.yml',
|
||||
'package-version' => InstalledVersions::getPrettyVersion('filament/support'),
|
||||
'laravel-version' => InstalledVersions::getPrettyVersion('laravel/framework'),
|
||||
'livewire-version' => InstalledVersions::getPrettyVersion('livewire/livewire'),
|
||||
'php-version' => PHP_VERSION,
|
||||
]));
|
||||
}
|
||||
|
||||
public function openUrlInBrowser(string $url): void
|
||||
{
|
||||
if (PHP_OS_FAMILY === 'Darwin') {
|
||||
exec('open "' . $url . '"');
|
||||
}
|
||||
if (PHP_OS_FAMILY === 'Linux') {
|
||||
exec('xdg-open "' . $url . '"');
|
||||
}
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
exec('start "" "' . $url . '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,11 @@ use Filament\Support\Assets\AssetManager;
|
||||
use Filament\Support\Assets\Css;
|
||||
use Filament\Support\Assets\Js;
|
||||
use Filament\Support\Colors\ColorManager;
|
||||
use Filament\Support\Commands\Aliases\MakeIssueCommand as MakeIssueCommandAlias;
|
||||
use Filament\Support\Commands\AssetsCommand;
|
||||
use Filament\Support\Commands\CheckTranslationsCommand;
|
||||
use Filament\Support\Commands\InstallCommand;
|
||||
use Filament\Support\Commands\MakeIssueCommand;
|
||||
use Filament\Support\Commands\UpgradeCommand;
|
||||
use Filament\Support\Components\ComponentManager;
|
||||
use Filament\Support\Components\Contracts\ScopedComponentManager;
|
||||
@@ -39,6 +41,9 @@ class SupportServiceProvider extends PackageServiceProvider
|
||||
CheckTranslationsCommand::class,
|
||||
InstallCommand::class,
|
||||
UpgradeCommand::class,
|
||||
|
||||
MakeIssueCommand::class,
|
||||
MakeIssueCommandAlias::class,
|
||||
])
|
||||
->hasConfigFile()
|
||||
->hasTranslations()
|
||||
|
||||
Reference in New Issue
Block a user