Add all files
This commit is contained in:
104
extensions/Others/KnowledgeBase/KnowledgeBase.php
Normal file
104
extensions/Others/KnowledgeBase/KnowledgeBase.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace Paymenter\Extensions\Others\KnowledgeBase;
|
||||
|
||||
use App\Classes\Extension\Extension;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Paymenter\Extensions\Others\KnowledgeBase\Admin\Resources\KnowledgeBaseResource;
|
||||
use Paymenter\Extensions\Others\KnowledgeBase\Models\Article;
|
||||
use Paymenter\Extensions\Others\KnowledgeBase\Models\Category;
|
||||
|
||||
class KnowledgeBase extends Extension
|
||||
{
|
||||
public function getConfig($values = [])
|
||||
{
|
||||
try {
|
||||
return [
|
||||
[
|
||||
'name' => 'Notice',
|
||||
'type' => 'placeholder',
|
||||
'label' => new HtmlString(
|
||||
'Use this extension to create articles to help your customers without needing to chat with them.
|
||||
Make and manage your articles at <a class="text-primary-600" href="' . KnowledgeBaseResource::getUrl() . '">KnowledgeBase</a>.
|
||||
<br><br><small><i>Do you need support? Join our discord server at <a href="https://discord.gg/V3nJ3jVURN">https://discord.gg/V3nJ3jVURN</a></small></i>'
|
||||
),
|
||||
],
|
||||
];
|
||||
} catch (\Exception $e) {
|
||||
return [
|
||||
[
|
||||
'name' => 'Notice',
|
||||
'type' => 'placeholder',
|
||||
'label' => new HtmlString(
|
||||
'Use this extension to create articles to help your customers without needing to chat with them. You need to enable it before you can use it.
|
||||
<br><br><small><i>Do you need support? Join our discord server at <a href="https://discord.gg/V3nJ3jVURN">https://discord.gg/V3nJ3jVURN</a></small></i>'
|
||||
),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function enabled()
|
||||
{
|
||||
|
||||
Artisan::call('migrate', [
|
||||
'--path' => 'extensions/Others/KnowledgeBase/database/migrations',
|
||||
'--force' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
|
||||
require __DIR__ . '/routes/web.php';
|
||||
View::addNamespace('knowledgebase', __DIR__ . '/resources/views');
|
||||
|
||||
// Livewire componenten
|
||||
\Livewire\Livewire::component('knowledgebase.index', \Paymenter\Extensions\Others\KnowledgeBase\Livewire\Index::class);
|
||||
\Livewire\Livewire::component('knowledgebase.show', \Paymenter\Extensions\Others\KnowledgeBase\Livewire\Show::class);
|
||||
\Livewire\Livewire::component('knowledgebase.category', \Paymenter\Extensions\Others\KnowledgeBase\Livewire\Category::class);
|
||||
\Livewire\Livewire::component('knowledgebase.widget', \Paymenter\Extensions\Others\KnowledgeBase\Livewire\Widget::class);
|
||||
|
||||
// adminpagina Os
|
||||
Event::listen('navigation', function () {
|
||||
if (Article::where('is_active', true)->count() === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => 'Documentation',
|
||||
'route' => 'knowledgebase.index',
|
||||
'icon' => 'ri-book-open',
|
||||
'separator' => true,
|
||||
'children' => [],
|
||||
];
|
||||
});
|
||||
|
||||
// Homepage
|
||||
Event::listen('pages.home', function () {
|
||||
return [
|
||||
'view' => view('knowledgebase::index', [
|
||||
'articles' => Article::where('is_active', true)
|
||||
->orderBy('published_at', 'desc')
|
||||
->get(),
|
||||
'categories' => Category::all(),
|
||||
]),
|
||||
];
|
||||
});
|
||||
|
||||
// klanten Dashboard
|
||||
Event::listen('pages.dashboard', function () {
|
||||
return [
|
||||
'view' => view('knowledgebase::widget', [
|
||||
'articles' => Article::where('is_active', true)
|
||||
->orderBy('published_at', 'desc')
|
||||
->take(3)
|
||||
->get(),
|
||||
]),
|
||||
];
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user