laravel_board maintained by wangta69
Laravel Board (K-BBS)
A Korean-style Bulletin Board System (BBS) package for Laravel.
한국형 계층형 게시판(BBS)을 라라벨에서 쉽고 빠르게 구축하기 위한 패키지입니다.
💡 Overview
This library is designed to implement the hierarchical board structure (List, View, Write, Reply, Comment) commonly used in Korea within the Laravel environment. It supports Bootstrap 5 by default.
이 라이브러리는 길라(Gilra) (Online Fortune Service)의 커뮤니티 및 공지사항 기능을 구축하는 데 실제로 사용되었습니다.
- Demo: Live Demo Link
- Official Docs: Documentation
🚀 Features
- Korean Style BBS: Hierarchical posts (Reply), Comments, Secret posts.
- Admin Panel: Built-in controller and views for board management.
- Thumbnails: Real-time thumbnail generator helper.
- Widgets: Latest posts widget helper.
- Comments Component: Easily add comment functionality to any model.
📦 Installation
Requirements
- PHP >= 7.4
- Laravel >= 8.x (Tested on 8.x ~ 11.x)
- Bootstrap 5.x
- jQuery 3.6.x
1. Require the package via Composer
composer require wangta69/laravel-board
2. Install Assets & Config
Run the installation command to publish assets and migration files.
php artisan pondol:install-bbs
🛠 Configuration & Usage
1. Admin Security Setup
After installation, you should secure the Admin Controller.
Go to App/Http/Controllers/Bbs/Admin/BbsController.php (or similar admin controllers) and set up the middleware or permission check in the __construct method.
public function __construct()
{
$this->middleware('auth');
// Example: Check for administrator role
// if (!Auth::user()->hasRole('administrator')) {
// abort(403, 'Unauthorized action.');
// }
}
2. Create a Board
- Access the admin panel:
http://YourDomain/bbs/admin - Create a new board configuration (e.g., table name:
notice). - (Optional) If you need a role management system:
php artisan make:model Role -m
3. Access the Board
- Admin URL:
http://YourDomain/bbs/admin/tbl/{table_name} - User URL:
http://YourDomain/bbs/{table_name}
🎨 Helpers & Components
Real-time Thumbnail
Generate thumbnails on the fly.
<!-- usage: bbs_get_thumb($image_path, $width, $height) -->
<img
src="{{ bbs_get_thumb($article->image, 205, 205) }}"
alt="{{ $article->title }}"
/>
Latest Posts Widget
Display the latest posts from a specific board.
public function index()
{
// usage: bbs_get_latest(['table' => 'table_name', 'cnt' => count])
$notices = bbs_get_latest(['table' => 'notice', 'cnt' => 5]);
return view('welcome', compact('notices'));
}
Forum (Comment) Component
You can attach a comment section to any arbitrary model or page, not just the BBS.
<x-item-comments item="story" :itemId="$story->id" skin="default" />
- skin: Skin name (currently 'default' is available).
- item: Target category or model name (string).
- itemId: Unique ID of the target content.
📂 Customization
To customize the templates, look into the resources/views/bbs/templates directory. You can duplicate an existing template and modify it to create your own skin.
🛠 SEO & Meta Data Customization
Laravel Board supports dynamic meta data management through Pondol\Meta. You can customize how meta titles, descriptions, and images are generated for each board by implementing a custom Resolver.
1. Create a Custom Meta Resolver
Create a class in your app (e.g., App\Services\BbsMetaResolver.php) that implements Pondol\Bbs\Contracts\BbsMetaResolver.
namespace App\Services;
use Pondol\Bbs\Contracts\BbsMetaResolver;
use Illuminate\Support\Str;
class MyBbsMetaResolver implements BbsMetaResolver
{
/**
* @param \Pondol\Meta\Meta $meta
* @param string $type 'index' or 'show'
* @param object $cfg Board Configuration (BbsTables)
* @param object|null $article Article Data (BbsArticles)
*/
public function resolve($meta, $type, $cfg, $article = null)
{
// Custom logic for specific boards
if ($cfg->table_name === 'notice') {
$meta->title("[Notice] " . ($article ? $article->title : $cfg->name));
}
// Custom image logic for detailed view
if ($type === 'show' && $article) {
$description = Str::limit(strip_tags($article->content), 160);
$meta->description($description);
if ($article->image) {
$meta->image(\Storage::url($article->image));
}
}
return $meta;
}
}
2. Register the Resolver
Bind your custom class to the interface in App\Providers\AppServiceProvider.php.
public function register()
{
$this->app->bind(
\Pondol\Bbs\Contracts\BbsMetaResolver::class,
\App\Services\MyBbsMetaResolver::class
);
}
By doing this, you can fully control the SEO strategy for each board without modifying the package core.
📜 License
The MIT License (MIT). Please see License File for more information.