1. Go to this page and download the library: Download weeklify/ez-knowledge-base library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Models;
use EzKnowledgeBase\Models\KbArticle as BaseKbArticle;
use Laravel\Scout\Searchable;
class KbArticle extends BaseKbArticle
{
use Searchable;
public function toSearchableArray(): array
{
return [
'id' => $this->id,
'title' => $this->title,
'excerpt' => $this->excerpt,
'body' => strip_tags(str($this->body)->markdown()),
'category_name' => $this->category?->name,
];
}
public function shouldBeSearchable(): bool
{
return $this->is_published;
}
}
namespace App\Models;
use EzKnowledgeBase\Traits\CanKbTicket;
use EzKnowledgeBase\Traits\ManageKbTicket;
use EzKnowledgeBase\Traits\AdminKbTicket;
class User extends Authenticatable
{
use CanKbTicket; // Customer: create and reply to own tickets
use ManageKbTicket; // Staff/Agent: reply to tickets as staff
use AdminKbTicket; // Admin: resolve, close, change status, admin checks
}
[
'title' => 'My New Article',
'slug' => 'my-new-article',
'excerpt' => 'A brief description of this article.',
'body' => <<<'MD'
# My New Article
Your markdown content here...
MD,
'is_published' => true,
'is_featured' => false,
'read_time_minutes' => 5,
'sort_order' => 1,
],
bash
# Publish the config file to config/kb.php
php artisan vendor:publish --tag=kb-config
# Publish the default logo to public/vendor/kb/
php artisan vendor:publish --tag=kb-assets