diff --git a/config/zeus-sky.php b/config/zeus-sky.php new file mode 100644 index 0000000..fa3ff75 --- /dev/null +++ b/config/zeus-sky.php @@ -0,0 +1,26 @@ + 'sky', + 'middleware' => ['web'], + 'uriPrefix' => [ + 'post' => 'post', + 'page' => 'page', + 'library' => 'library', + 'faq' => 'faq', + ], + 'enabledResources' => [ + 'PostResource', + 'PageResource', + 'FaqResource', + 'LibraryResource', + ], + 'parsers'=>[ + \LaraZeus\Sky\Classes\BoltParser::class, + ], + 'recentPostsLimit' => 5, + 'searchResultHighlightCssClass' => 'highlight', + 'skipHighlightingTerms' => ['iframe'], + 'defaultFeaturedImage' => null, + +]; diff --git a/routes/web.php b/routes/web.php index 91b841e..0741925 100644 --- a/routes/web.php +++ b/routes/web.php @@ -9,48 +9,46 @@ use LaraZeus\Sky\Http\Livewire\Post; use LaraZeus\Sky\Http\Livewire\Posts; use LaraZeus\Sky\Http\Livewire\Tags; -use LaraZeus\Sky\SkyPlugin; $filament = app('filament'); -if (! defined('__PHPSTAN_RUNNING__') && app('filament')->hasPlugin('zeus-sky')) { - Route::prefix(SkyPlugin::get()->getSkyPrefix()) - ->middleware(SkyPlugin::get()->getMiddleware()) - ->group(function () { +Route::prefix(config('zeus-sky.prefix')) + ->middleware(config('zeus-sky.middleware')) + ->group(function () { - if (SkyPlugin::get()->hasFaqResource()) { - Route::get(SkyPlugin::get()->getUriPrefix()['faq'], Faq::class) - ->name('faq'); - } + if (in_array('FaqResource', config('zeus-sky.enabledResources'))) { + Route::get(config('zeus-sky.uriPrefix.faq'), Faq::class) + ->name('faq'); + } - if (SkyPlugin::get()->hasLibraryResource()) { - Route::prefix(SkyPlugin::get()->getUriPrefix()['library'])->group(function () { + if (in_array('LibraryResource', config('zeus-sky.enabledResources'))) { + Route::prefix(config('zeus-sky.uriPrefix.library')) + ->group(function () { Route::get('/', Library::class)->name('library'); Route::get('/tag/{slug}', LibraryTag::class)->name('library.tag'); Route::get('/{slug}', LibraryItem::class)->name('library.item'); }); - } + } - Route::post('passwordConfirmation/{slug}', function ($slug) { + /*Route::post('passwordConfirmation/{slug}', function ($slug) { + // convert to LW todo + $post = SkyPlugin::get()->getModel('Post')::query() + ->where('slug', $slug) + ->where('password', request('password')) + ->first(); - $post = SkyPlugin::get()->getModel('Post')::query() - ->where('slug', $slug) - ->where('password', request('password')) - ->first(); + if ($post !== null) { + request()->session()->put($slug.'-'.request('password'), request('password')); - if ($post !== null) { - request()->session()->put($slug . '-' . request('password'), request('password')); - - return redirect()->route($post->post_type, ['slug' => $post->slug]); - } + return redirect()->route($post->post_type, ['slug' => $post->slug]); + } - return redirect()->back()->with('status', __('sorry, the password incorrect!')); - }) - ->name('passwordConfirmation'); + return redirect()->back()->with('status', __('sorry, the password incorrect!')); + }) + ->name('passwordConfirmation');*/ - Route::get('/', Posts::class)->name('blogs'); - Route::get(SkyPlugin::get()->getUriPrefix()['post'] . '/{slug}', Post::class)->name('post'); - Route::get(SkyPlugin::get()->getUriPrefix()['page'] . '/{slug}', Page::class)->name('page'); - Route::get('{type}/{slug}', Tags::class)->name('tags'); - }); -} + Route::get('/', Posts::class)->name('blogs'); + Route::get(config('zeus-sky.uriPrefix.post').'/{slug}', Post::class)->name('post'); + Route::get(config('zeus-sky.uriPrefix.page').'/{slug}', Page::class)->name('page'); + Route::get('{type}/{slug}', Tags::class)->name('tags'); + }); diff --git a/src/SkyServiceProvider.php b/src/SkyServiceProvider.php index f84357a..8070174 100644 --- a/src/SkyServiceProvider.php +++ b/src/SkyServiceProvider.php @@ -28,6 +28,7 @@ public function configurePackage(Package $package): void ->name(static::$name) ->hasMigrations($this->getMigrations()) ->hasTranslations() + ->hasConfigFile() ->hasCommands($this->getCommands()) ->hasViews('zeus') ->hasRoute('web');