mirror of
https://github.com/filamentphp/plugin-skeleton.git
synced 2025-12-07 05:58:51 +08:00
wip
This commit is contained in:
19
src/Commands/SkeletonCommand.php
Normal file
19
src/Commands/SkeletonCommand.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SkeletonCommand extends Command
|
||||
{
|
||||
public $signature = 'skeleton';
|
||||
|
||||
public $description = 'My command';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
$this->comment('All done');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
16
src/Facades/Skeleton.php
Normal file
16
src/Facades/Skeleton.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
/**
|
||||
* @see \VendorName\Skeleton\Skeleton
|
||||
*/
|
||||
class Skeleton extends Facade
|
||||
{
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return \VendorName\Skeleton\Skeleton::class;
|
||||
}
|
||||
}
|
||||
7
src/Skeleton.php
Normal file
7
src/Skeleton.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
class Skeleton
|
||||
{
|
||||
}
|
||||
@@ -2,39 +2,56 @@
|
||||
|
||||
namespace VendorName\Skeleton;
|
||||
|
||||
//use Filament\Support\Assets\Js;
|
||||
//use Filament\Support\Assets\Css;
|
||||
use Filament\Support\Assets\Asset;
|
||||
use Filament\PluginServiceProvider;
|
||||
use Spatie\LaravelPackageTools\Package;
|
||||
//use Filament\Support\Assets\AlpineComponent;
|
||||
use VendorName\Skeleton\Commands\SkeletonCommand;
|
||||
|
||||
class SkeletonServiceProvider extends PluginServiceProvider
|
||||
{
|
||||
public static string $name = 'skeleton';
|
||||
|
||||
protected array $resources = [
|
||||
// CustomResource::class,
|
||||
];
|
||||
|
||||
protected array $pages = [
|
||||
// CustomPage::class,
|
||||
];
|
||||
|
||||
protected array $widgets = [
|
||||
// CustomWidget::class,
|
||||
];
|
||||
|
||||
protected array $styles = [
|
||||
'plugin-skeleton' => __DIR__.'/../resources/dist/skeleton.css',
|
||||
];
|
||||
|
||||
protected array $scripts = [
|
||||
'plugin-skeleton' => __DIR__.'/../resources/dist/skeleton.js',
|
||||
];
|
||||
|
||||
// protected array $beforeCoreScripts = [
|
||||
// 'plugin-skeleton' => __DIR__ . '/../resources/dist/skeleton.js',
|
||||
// ];
|
||||
|
||||
public function configurePackage(Package $package): void
|
||||
{
|
||||
$package->name(static::$name);
|
||||
$package->name(static::$name)
|
||||
->hasConfigFile()
|
||||
->hasViews()
|
||||
->hasMigration('create_skeleton_table')
|
||||
->hasCommand(SkeletonCommand::class);
|
||||
}
|
||||
|
||||
public function packageRegistered(): void
|
||||
{
|
||||
parent::packageRegistered();
|
||||
|
||||
$this->app->bind('skeleton', function (): Skeleton {
|
||||
return new Skeleton();
|
||||
});
|
||||
}
|
||||
|
||||
public function packageBooted(): void
|
||||
{
|
||||
parent::packageBooted();
|
||||
}
|
||||
|
||||
protected function getAssetPackage(): ?string
|
||||
{
|
||||
return 'skeleton';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<Asset>
|
||||
*/
|
||||
protected function getAssets(): array
|
||||
{
|
||||
return [
|
||||
// AlpineComponent::make('skeleton', __DIR__ . '/../resources/dist/components/skeleton.js'),
|
||||
// Css::make('echo', __DIR__ . '/../resources/dist/skeleton.js'),
|
||||
// Js::make('echo', __DIR__ . '/../resources/dist/skeleton.js'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
31
src/SkeletonTheme.php
Normal file
31
src/SkeletonTheme.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Filament;
|
||||
|
||||
use Filament\Context;
|
||||
use Filament\Contracts\Plugin;
|
||||
use Filament\Support\Assets\Theme;
|
||||
use Filament\Support\Facades\FilamentAsset;
|
||||
|
||||
class SkeletonTheme implements Plugin
|
||||
{
|
||||
public function getId(): string
|
||||
{
|
||||
return 'skeleton-theme';
|
||||
}
|
||||
|
||||
public function register(Context $context): void
|
||||
{
|
||||
FilamentAsset::register([
|
||||
Theme::make('skeleton', __DIR__ . '/../resources/dist/skeleton.css'),
|
||||
]);
|
||||
|
||||
$context
|
||||
->theme('skeleton');
|
||||
}
|
||||
|
||||
public function boot(Context $context): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user