Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Sep 22, 2023
1 parent 37e7a3d commit 0e4e9c1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 31 deletions.
26 changes: 26 additions & 0 deletions config/zeus-sky.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

return [
'prefix' => '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,

];
60 changes: 29 additions & 31 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
1 change: 1 addition & 0 deletions src/SkyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 0e4e9c1

Please sign in to comment.