Added blog, pages, menu, category

This commit is contained in:
Gitea
2025-04-28 01:09:25 +05:30
parent 66cf32a7bb
commit 08e1110abd
36 changed files with 1205 additions and 34 deletions

22
app/Livewire/Blog.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
namespace App\Livewire;
use App\Models\Category;
use Livewire\Component;
class Blog extends Component
{
public $postDetail;
public $category;
public function mount($slug) {
$this->postDetail = \App\Models\Blog::where('slug', $slug)->firstOrFail();
$this->category = Category::where('id', $this->postDetail->category_id)->first();
}
public function render()
{
return view('livewire.blog')->with('postDetail', $this->postDetail)->with('category', $this->category);
}
}

28
app/Livewire/Page.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
namespace App\Livewire;
use Livewire\Component;
class Page extends Component
{
public $slug;
public function mount($slug)
{
$this->slug = $slug;
}
public function render()
{
$page = \App\Models\Page::where('slug', $this->slug)->firstOrFail();
if ($page->is_published == false ) {
abort(404);
}
return view('livewire.page', [
'page' => $page,
]);
}
}