Add all files
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Paymenter\Extensions\Others\KnowledgeBase\Livewire\KnowledgeBase;
|
||||
|
||||
use Livewire\Component;
|
||||
use Paymenter\Extensions\Others\KnowledgeBase\Models\Article;
|
||||
|
||||
class Index extends Component
|
||||
{
|
||||
public function mount()
|
||||
{
|
||||
if (Article::where('is_active', true)->where('published_at', '<=', now())->count() == 0) {
|
||||
return abort(404);
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('knowledgebase::index', [
|
||||
'articles' => Article::where('is_active', true)
|
||||
->where('published_at', '<=', now())
|
||||
->latest('published_at')
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Paymenter\Extensions\Others\KnowledgeBase\Livewire\KnowledgeBase;
|
||||
|
||||
use Livewire\Component;
|
||||
use Paymenter\Extensions\Others\KnowledgeBase\Models\Article;
|
||||
|
||||
class Show extends Component
|
||||
{
|
||||
public Article $article;
|
||||
|
||||
public function mount(Article $article)
|
||||
{
|
||||
if (!$article->is_active || $article->published_at > now()) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$this->article = $article;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('knowledgebase::show', [
|
||||
'article' => $this->article,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace Paymenter\Extensions\Others\KnowledgeBase\Livewire\KnowledgeBase;
|
||||
|
||||
use Livewire\Component;
|
||||
use Paymenter\Extensions\Others\KnowledgeBase\Models\Article;
|
||||
|
||||
class Widget extends Component
|
||||
{
|
||||
public function mount()
|
||||
{
|
||||
if (Article::where('is_active', true)->where('published_at', '<=', now())->count() == 0) {
|
||||
abort(404);
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('knowledgebase::widget', [
|
||||
'articles' => Article::where('is_active', true)
|
||||
->where('published_at', '<=', now())
|
||||
->latest('published_at')
|
||||
->get(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user