Skip to content

Commit

Permalink
add publish token resource
Browse files Browse the repository at this point in the history
  • Loading branch information
rupadana committed Jan 27, 2024
1 parent 7e94b71 commit bedd9ce
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/ApiServiceServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
use Filament\Support\Facades\FilamentAsset;
use Filament\Support\Facades\FilamentIcon;
use Illuminate\Filesystem\Filesystem;
use Laravel\Sanctum\Http\Middleware\CheckAbilities;
use Laravel\Sanctum\Http\Middleware\CheckForAnyAbility;
use Livewire\Features\SupportTesting\Testable;
use Rupadana\ApiService\Commands\MakeApiHandlerCommand;
use Rupadana\ApiService\Commands\MakeApiServiceCommand;
use Rupadana\ApiService\Commands\MakeApiTransformerCommand;
use Rupadana\ApiService\Testing\TestsApiService;
use Spatie\LaravelPackageTools\Commands\InstallCommand;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
Expand All @@ -33,9 +33,10 @@ public function configurePackage(Package $package): void
->hasInstallCommand(function (InstallCommand $command) {
$command
->publishConfigFile()
->askToStarRepoOnGitHub('rupadana/filament-api-service');
})
->hasRoute('api');
->publishMigrations()
->askToRunMigrations()
->askToStarRepoOnGitHub('rupadana/api-service');
});

$configFileName = $package->shortName();

Expand Down Expand Up @@ -78,16 +79,19 @@ public function packageBooted(): void

// Handle Stubs
if (app()->runningInConsole()) {
foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) {
$this->publishes([
$file->getRealPath() => base_path("stubs/api-service/{$file->getFilename()}"),
], 'api-service-stubs');
}
// foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) {
// $this->publishes([
// $file->getRealPath() => base_path("stubs/api-service/{$file->getFilename()}"),
// ], 'api-service-stubs');
// }

$this->publishes([
__DIR__ . '/Resources' => app_path('/Filament/Resources')
], 'api-service-resource');
}

$router = app('router');
$router->aliasMiddleware('abilities', CheckAbilities::class);
$router->aliasMiddleware('ability', CheckForAnyAbility::class);
// Testing
// Testable::mixin(new TestsApiService());
}

protected function getAssetPackageName(): ?string
Expand Down

0 comments on commit bedd9ce

Please sign in to comment.