From 1fbc907ba7b9f05d8a06f4fc4fb987501a5f8636 Mon Sep 17 00:00:00 2001 From: Ashraf Monshi Date: Mon, 18 Apr 2022 00:29:34 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=F0=9F=9A=80=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/changelog.md | 2 +- docs/installation-and-setup.md | 50 ------------------- docs/introduction.md | 11 ++-- docs/update.md | 2 +- .../views/themes/zeus/category.blade.php | 2 +- resources/views/themes/zeus/home.blade.php | 10 ++-- resources/views/themes/zeus/page.blade.php | 4 +- .../views/themes/zeus/partial/post.blade.php | 2 +- .../themes/zeus/partial/related.blade.php | 2 +- .../themes/zeus/partial/sidebar.blade.php | 8 +-- resources/views/themes/zeus/post.blade.php | 4 +- src/Http/Livewire/Page.php | 2 +- src/Http/Livewire/Post.php | 2 +- src/Http/Livewire/Posts.php | 2 +- src/Http/Livewire/Tags.php | 4 +- src/Models/Tag.php | 5 ++ src/SkyServiceProvider.php | 12 ++++- 17 files changed, 46 insertions(+), 78 deletions(-) delete mode 100644 docs/installation-and-setup.md diff --git a/docs/changelog.md b/docs/changelog.md index 4b9b3dd..4df161e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,6 +1,6 @@ --- title: Changelog -weight: 10 +weight: 100 --- All changes to `sky` are documented on GitHub [changelog](https://github.com/lara-zeus/sky/blob/main/CHANGELOG.md) diff --git a/docs/installation-and-setup.md b/docs/installation-and-setup.md deleted file mode 100644 index 3f1bb7b..0000000 --- a/docs/installation-and-setup.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: Installation and Setup -weight: 2 ---- - -## Installation - -You can install the package via composer: - -```bash -composer require lara-zeus/wind -``` - -then run the command to install and publish all Wind components - -```bash -php artisan wind:publish -``` - - -which will run the following commands: - -```bash -php artisan vendor:publish --tag=zeus-wind-config -php artisan vendor:publish --tag=zeus-wind-migrations -php artisan vendor:publish --tag=zeus-wind-views -php artisan vendor:publish --tag=zeus-wind-seeder -php artisan vendor:publish --tag=zeus-wind-factories -php artisan vendor:publish --tag=zeus-zeus-config -php artisan vendor:publish --tag=zeus-zeus-views -php artisan vendor:publish --tag=zeus-zeus-assets -``` - -you can pass `--force` option to force publishing all files - -```bash -php artisan wind:publish --force -``` - -## Usage - -visit the url `/admin` to manage the Letters, and `/contact-us` to access the contact form. -> you can configure the URL from the config file - -if you dont have a user, or it's a fresh instalation of laravel, you can use the command to create a new user -```bash -php artisan make:filament-user -``` - -More Documentation are coming soon... diff --git a/docs/introduction.md b/docs/introduction.md index 91fe6a6..ace053c 100644 --- a/docs/introduction.md +++ b/docs/introduction.md @@ -3,9 +3,10 @@ title: Introduction weight: 1 --- -Lara-zeus sky, is a contact form provides a simple contact form manager, with the ability to store the messages in the database, and you can reply to them from a dashboard. +## Introduction +@zeus sky, is a simple CMS for your website. it includes posts, pages, tags, and categories, with a frontend scaffolding. -**[Demo](https://sky.larazeus.com) · [Github](https://github.com/lara-zeus/sky)** +**[Demo](https://demo.larazeus.com) · [Github](https://github.com/lara-zeus/sky)** ## features - 🔥 built with [TALL stack](https://tallstack.dev/) @@ -22,4 +23,8 @@ Lara-zeus sky, is a contact form provides a simple contact form manager, with th - multiple tags and categories - Featured Image -and more in the way. +and more in the way: +- authers +- menus +- comments +- and more! diff --git a/docs/update.md b/docs/update.md index f5c923c..22d70a6 100644 --- a/docs/update.md +++ b/docs/update.md @@ -1,6 +1,6 @@ --- title: update -weight: 3 +weight: 99 --- ## Composer diff --git a/resources/views/themes/zeus/category.blade.php b/resources/views/themes/zeus/category.blade.php index 8482410..e206eca 100644 --- a/resources/views/themes/zeus/category.blade.php +++ b/resources/views/themes/zeus/category.blade.php @@ -2,7 +2,7 @@ @unless($posts->isEmpty())
@foreach($posts as $post) - @include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.sticky') + @include($theme.'.partial.sticky') @endforeach
@endunless diff --git a/resources/views/themes/zeus/home.blade.php b/resources/views/themes/zeus/home.blade.php index 05e567e..fb5ce36 100644 --- a/resources/views/themes/zeus/home.blade.php +++ b/resources/views/themes/zeus/home.blade.php @@ -2,7 +2,7 @@ @unless($stickies->isEmpty())
@foreach($stickies as $post) - @include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.sticky') + @include($theme.'.partial.sticky') @endforeach
@endunless @@ -16,16 +16,16 @@

Posts

- @each('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.post', $posts, 'post') + @each($theme.'.partial.post', $posts, 'post') @else - @include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.empty') + @include($theme.'.partial.empty') @endunless
- @include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.sidebar') + @include($theme.'.partial.sidebar')
@else - @include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.empty') + @include($theme.'.partial.empty') @endunless diff --git a/resources/views/themes/zeus/page.blade.php b/resources/views/themes/zeus/page.blade.php index 6520d9d..97dba31 100644 --- a/resources/views/themes/zeus/page.blade.php +++ b/resources/views/themes/zeus/page.blade.php @@ -21,7 +21,7 @@ {{ optional($post->published_at)->diffForHumans() ?? '' }}
@unless ($post->tags->isEmpty()) - @each('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.tag', $post->tags->where('type','category'), 'tag') + @each($theme.'.partial.tag', $post->tags->where('type','category'), 'tag') @endunless
@@ -54,7 +54,7 @@
@foreach($children as $post) - @include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.children-pages') + @include($theme.'.partial.children-pages') @endforeach
diff --git a/resources/views/themes/zeus/partial/post.blade.php b/resources/views/themes/zeus/partial/post.blade.php index 246c07f..bc4e898 100644 --- a/resources/views/themes/zeus/partial/post.blade.php +++ b/resources/views/themes/zeus/partial/post.blade.php @@ -4,7 +4,7 @@ {{ optional($post->published_at)->diffForHumans() ?? '' }}
@unless ($post->tags->isEmpty()) - @each('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.tag', $post->tags->where('type','category'), 'tag') + @each($theme.'.partial.tag', $post->tags->where('type','category'), 'tag') @endunless
diff --git a/resources/views/themes/zeus/partial/related.blade.php b/resources/views/themes/zeus/partial/related.blade.php index 4eb84bc..1fc40f7 100644 --- a/resources/views/themes/zeus/partial/related.blade.php +++ b/resources/views/themes/zeus/partial/related.blade.php @@ -9,7 +9,7 @@
@unless ($post->tags->isEmpty()) - @each('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.tag', $post->tags->where('type','category'), 'tag') + @each($theme.'.partial.tag', $post->tags->where('type','category'), 'tag') @endunless
diff --git a/resources/views/themes/zeus/partial/sidebar.blade.php b/resources/views/themes/zeus/partial/sidebar.blade.php index 38a1e0d..acbf366 100644 --- a/resources/views/themes/zeus/partial/sidebar.blade.php +++ b/resources/views/themes/zeus/partial/sidebar.blade.php @@ -1,4 +1,4 @@ -{{--@include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.authors')--}} -@include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.sidebar.categories') -@include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.sidebar.recent') -@include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.sidebar.pages') +{{--@include($theme.'.partial.authors')--}} +@include($theme.'.partial.sidebar.categories') +@include($theme.'.partial.sidebar.recent') +@include($theme.'.partial.sidebar.pages') diff --git a/resources/views/themes/zeus/post.blade.php b/resources/views/themes/zeus/post.blade.php index 6f3602c..b46b058 100644 --- a/resources/views/themes/zeus/post.blade.php +++ b/resources/views/themes/zeus/post.blade.php @@ -18,7 +18,7 @@ {{ optional($post->published_at)->diffForHumans() ?? '' }}
@unless ($post->tags->isEmpty()) - @each('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.tag', $post->tags->where('type','category'), 'tag') + @each($theme.'.partial.tag', $post->tags->where('type','category'), 'tag') @endunless
@@ -51,7 +51,7 @@
@foreach($related as $post) - @include('zeus-sky::themes.'.config('zeus-sky.theme').'.partial.related') + @include($theme.'.partial.related') @endforeach
diff --git a/src/Http/Livewire/Page.php b/src/Http/Livewire/Page.php index 0cce498..591b5b1 100644 --- a/src/Http/Livewire/Page.php +++ b/src/Http/Livewire/Page.php @@ -24,7 +24,7 @@ public function render() ->description($this->page->description) ->twitter(); - return view('zeus-sky::themes.'.config('zeus-sky.theme').'.page') + return view(app('theme') . '.page') ->with([ 'post' => $this->page, 'children' => Post::with('parent')->where('parent_id', $this->page->id)->get(), diff --git a/src/Http/Livewire/Post.php b/src/Http/Livewire/Post.php index 2d35b88..3654dda 100644 --- a/src/Http/Livewire/Post.php +++ b/src/Http/Livewire/Post.php @@ -24,7 +24,7 @@ public function render() ->description($this->post->description) ->twitter(); - return view('zeus-sky::themes.'.config('zeus-sky.theme').'.post') + return view(app('theme').'.post') ->with('post', $this->post) ->with('related', postModel::related($this->post)->take(4)->get()) ->layout(config('zeus-sky.layout')); diff --git a/src/Http/Livewire/Posts.php b/src/Http/Livewire/Posts.php index a5a97a5..89be790 100644 --- a/src/Http/Livewire/Posts.php +++ b/src/Http/Livewire/Posts.php @@ -10,7 +10,7 @@ class Posts extends Component { public function render() { - return view('zeus-sky::themes.'.config('zeus-sky.theme').'.home') + return view(app('theme').'.home') ->with([ 'posts' => Post::NotSticky()->orderBy('published_at', 'desc')->get(), 'pages' => Post::page()->orderBy('published_at', 'desc')->whereNull('parent_id')->get(), diff --git a/src/Http/Livewire/Tags.php b/src/Http/Livewire/Tags.php index 297e7ed..4117a32 100644 --- a/src/Http/Livewire/Tags.php +++ b/src/Http/Livewire/Tags.php @@ -26,9 +26,9 @@ public function render() ->description('Show All posts in '.$this->tag->name) ->twitter(); - return view('zeus-sky::themes.'.config('zeus-sky.theme').'.category') + return view(app('theme').'.category') ->with([ - 'posts' => Post::withAllTags([$this->slug], $this->type)->get(), + 'posts' => $this->tag->postsPublished, ]) ->layout(config('zeus-sky.layout')); } diff --git a/src/Models/Tag.php b/src/Models/Tag.php index 386cadf..3251d9c 100644 --- a/src/Models/Tag.php +++ b/src/Models/Tag.php @@ -9,6 +9,11 @@ public function posts() return $this->morphedByMany(Post::class, 'taggable'); } + public function postsPublished() + { + return $this->morphedByMany(Post::class, 'taggable')->published(); + } + protected function generateSlug(string $locale): string { if ($this->slug !== null) { diff --git a/src/SkyServiceProvider.php b/src/SkyServiceProvider.php index a25d57c..39c1b7d 100644 --- a/src/SkyServiceProvider.php +++ b/src/SkyServiceProvider.php @@ -3,6 +3,8 @@ namespace LaraZeus\Sky; use Filament\PluginServiceProvider; +use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\View; use LaraZeus\Sky\Filament\Resources\PageResource; use LaraZeus\Sky\Filament\Resources\PostResource; use LaraZeus\Sky\Filament\Resources\TagResource; @@ -18,11 +20,17 @@ public function boot() ->site(config('app.name', 'Laravel')) ->title(config('zeus-sky.site_title')) ->description(config('zeus-sky.site_description')) - ->rawTag('favicon', '') - ->rawTag('') + ->rawTag('favicon', '') + ->rawTag('') ->withUrl() ->twitter(); + View::share('theme', 'zeus-sky::themes.' . config('zeus-sky.theme')); + + App::singleton('theme', function () { + return 'zeus-sky::themes.' . config('zeus-sky.theme'); + }); + return parent::boot(); }