Skip to content

Commit

Permalink
use sky without the FR routes
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Sep 28, 2024
1 parent a60db9f commit 931fade
Show file tree
Hide file tree
Showing 13 changed files with 589 additions and 626 deletions.
1,157 changes: 544 additions & 613 deletions composer.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions config/zeus-sky.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
return [
'domain' => null,

/**
* disable all sky frontend routes.
*/
'headless' => false,

/**
* set the default path for the blog homepage.
*/
Expand Down
7 changes: 7 additions & 0 deletions docs/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ and here is the config content:
<?php

return [
'domain' => null,

/**
* disable all sky frontend routes.
*/
'headless' => false,

/**
* set the default path for the blog homepage.
*/
Expand Down
8 changes: 6 additions & 2 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ parameters:
- database
checkOctaneCompatibility: true
checkModelProperties: true
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false

ignoreErrors:
-
identifier: missingType.iterableValue
-
identifier: missingType.generics
3 changes: 0 additions & 3 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
use LaraZeus\Sky\Livewire\Post;
use LaraZeus\Sky\Livewire\Posts;
use LaraZeus\Sky\Livewire\Tags;
use LaraZeus\Sky\SkyPlugin;

$filament = app('filament');

Route::domain(config('zeus-sky.domain'))
->middleware(config('zeus-sky.middleware'))
Expand Down
3 changes: 1 addition & 2 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public function handle(): void
]);

$this->call('vendor:publish', [
'--provider' => 'Spatie\MediaLibrary\MediaLibraryServiceProvider',
'--tag' => 'migrations',
'--tag' => 'medialibrary-migrations',
]);

$this->info('publishing zeus assets...');
Expand Down
5 changes: 4 additions & 1 deletion src/Filament/Resources/FaqResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ public static function getActions(): array
->label(__('Delete')),
];

if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) {
if (
class_exists(\LaraZeus\Helen\HelenServiceProvider::class)
&& ! config('zeus-sky.headless')
) {
//@phpstan-ignore-next-line
$action[] = \LaraZeus\Helen\Actions\ShortUrlAction::make('get-link')
->distUrl(fn (): string => route(SkyPlugin::get()->getRouteNamePrefix() . 'faq'));
Expand Down
1 change: 1 addition & 0 deletions src/Filament/Resources/FaqResource/Pages/ListFaqs.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected function getActions(): array
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->visible(! config('zeus-sky.headless'))
->url(fn (): string => route(SkyPlugin::get()->getRouteNamePrefix() . 'faq'))
->openUrlInNewTab(),
LocaleSwitcher::make(),
Expand Down
6 changes: 5 additions & 1 deletion src/Filament/Resources/LibraryResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,17 @@ public static function getActions(): array
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->visible(! config('zeus-sky.headless'))
->url(fn (Library $record): string => route(SkyPlugin::get()->getRouteNamePrefix() . 'library.item', ['slug' => $record->slug]))
->openUrlInNewTab(),
DeleteAction::make('delete')
->label(__('Delete')),
];

if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) {
if (
class_exists(\LaraZeus\Helen\HelenServiceProvider::class)
&& ! config('zeus-sky.headless')
) {
//@phpstan-ignore-next-line
$action[] = \LaraZeus\Helen\Actions\ShortUrlAction::make('get-link')
->distUrl(fn (Library $record): string => route(SkyPlugin::get()->getRouteNamePrefix() . 'library.item', ['slug' => $record->slug]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ protected function getActions(): array
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->visible(! config('zeus-sky.headless'))
->url(fn (): string => route(SkyPlugin::get()->getRouteNamePrefix() . 'library'))
->openUrlInNewTab(),
LocaleSwitcher::make(),
Expand Down
6 changes: 5 additions & 1 deletion src/Filament/Resources/PageResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,18 @@ public static function getActions(): array
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->visible(! config('zeus-sky.headless'))
->url(fn (Post $record): string => route(SkyPlugin::get()->getRouteNamePrefix() . 'page', ['slug' => $record]))
->openUrlInNewTab(),
DeleteAction::make('delete'),
ForceDeleteAction::make(),
RestoreAction::make(),
];

if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) {
if (
class_exists(\LaraZeus\Helen\HelenServiceProvider::class)
&& ! config('zeus-sky.headless')
) {
//@phpstan-ignore-next-line
$action[] = \LaraZeus\Helen\Actions\ShortUrlAction::make('get-link')
->distUrl(fn (Post $record): string => route(SkyPlugin::get()->getRouteNamePrefix() . 'page', ['slug' => $record]));
Expand Down
6 changes: 5 additions & 1 deletion src/Filament/Resources/PostResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,18 @@ public static function getActions(): array
->color('warning')
->icon('heroicon-o-arrow-top-right-on-square')
->label(__('Open'))
->visible(! config('zeus-sky.headless'))
->url(fn (Post $record): string => route(SkyPlugin::get()->getRouteNamePrefix() . 'post', ['slug' => $record]))
->openUrlInNewTab(),
DeleteAction::make('delete'),
ForceDeleteAction::make(),
RestoreAction::make(),
];

if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) {
if (
class_exists(\LaraZeus\Helen\HelenServiceProvider::class)
&& ! config('zeus-sky.headless')
) {
//@phpstan-ignore-next-line
$action[] = \LaraZeus\Helen\Actions\ShortUrlAction::make('get-link')
->distUrl(fn (Post $record): string => route(SkyPlugin::get()->getRouteNamePrefix() . 'post', ['slug' => $record]));
Expand Down
7 changes: 5 additions & 2 deletions src/SkyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ public function configurePackage(Package $package): void
->hasTranslations()
->hasConfigFile()
->hasCommands($this->getCommands())
->hasViews('zeus')
->hasRoute('web');
->hasViews('zeus');

if (! config('zeus-sky.headless')) {
$package->hasRoute('web');
}
}

/**
Expand Down

0 comments on commit 931fade

Please sign in to comment.