Added blog, pages, menu, category
This commit is contained in:
22
app/Livewire/Blog.php
Normal file
22
app/Livewire/Blog.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user