christhompsontldr/laraboard
Laraboard is a Laravel package for creating a simple message board/forum-style feature in your app. It provides models, migrations, and helpers to manage boards, threads, and posts, so you can add discussion areas quickly without building everything from scratch.
Installation
composer require christhompsontldr/laraboard
Run migrations:
php artisan migrate
Publish assets/config:
php artisan vendor:publish --provider="Laraboard\LaraboardServiceProvider"
First Use Case
php artisan laraboard:install (creates admin user)./forum to see the default forum structure (categories, threads, posts).create-thread) to interact with the UI.Key Files to Review
config/laraboard.php (core settings like permissions, default categories).resources/views/forum/ (Livewire component templates).app/Providers/LaraboardServiceProvider.php (service binding).Thread Management
CreateThread Livewire component (triggered via /forum/create).EditThread component or override ThreadController@update.venturecraft/revisionable for rollback via Thread::withRevision($id)->restore().Permissions
// Assign a user to a role (e.g., 'moderator')
$user->attachRole('moderator');
// Check permissions in policies
public function update(User $user, Thread $thread) {
return $user->hasRole('moderator') || $thread->user_id === $user->id;
}
Search & Scouting
// Add to Thread model
public function toSearchableArray() {
return [
'title' => $this->title,
'body' => $this->body,
'slug' => $this->slug,
];
}
$threads = Thread::search('laravel')->get();
Markdown Support
artisanry/parsedown for post content:
use Artisanry\Parsedown\Parsedown;
$parsedown = new Parsedown();
$html = $parsedown->text($post->body);
Livewire Integration
php artisan vendor:publish --tag=laraboard-views
resources/views/vendor/laraboard/thread.blade.php.use Laraboard\Models\Category;
Category::create(['name' => 'Dev', 'slug' => 'dev']);
EventServiceProvider to listen to ThreadCreated events.Route::apiResource('threads', 'ThreadController')->middleware('auth:api');
Laravel Version Lock
scout v8 vs. v9+).config/laraboard.php or use a compatibility layer.Livewire Version Mismatch
wire:model → v-model in Blade).Permission Overrides
Laraboard\Policies\ThreadPolicy or use Gates:
Gate::define('delete-thread', function (User $user, Thread $thread) {
return $user->isAdmin();
});
Asset Paths
php artisan optimize:clear or manually link assets in web.php:
Vite::asset('resources/css/laraboard.css');
'scout' => [
'driver' => 'database',
'log' => env('SCOUT_LOG', true),
],
php artisan livewire:discover to regenerate components.// In AppServiceProvider boot()
\VentureCraft\Revisionable\Revisionable::ignoreModels(['Thread']);
Custom Fields
Thread model with morph maps:
public function morphTo() {
return 'thread';
}
thread_extra_attributes).Email Notifications
ThreadCreated event listener in EventServiceProvider:
ThreadCreated::class => [
\App\Listeners\SendThreadNotification::class,
],
Theming
_partials/thread-card.blade.php) in resources/views/vendor/laraboard/.:root {
--laraboard-primary: #{$config['colors']['primary']};
}
API Extensions
routes/api.php:
Route::get('/threads/{thread}/stats', [ThreadController::class, 'stats']);
How can I help you explore Laravel packages today?