Installation Add the package via Composer:
composer require atm/boardbundle
Register the bundle in config/app.php under providers:
Atm\BoardBundle\AtmBoardBundle::class,
Publish Assets & Config Run:
php artisan vendor:publish --provider="Atm\BoardBundle\AtmBoardBundle" --tag=config
php artisan vendor:publish --provider="Atm\BoardBundle\AtmBoardBundle" --tag=assets
This generates:
config/atm_board.php (default config)public/vendor/atm_board/First Use Case: Display a Board
Define a board in your config (config/atm_board.php):
'boards' => [
'default' => [
'title' => 'My Board',
'columns' => [
'todo' => ['title' => 'To-Do'],
'in_progress' => ['title' => 'In Progress'],
'done' => ['title' => 'Done'],
],
],
],
Render the board in a Blade template:
@board('default')
Runtime Overrides: Use dependency injection to pass custom board data:
$boardData = [
'title' => 'Dynamic Board',
'columns' => [...],
];
return view('my_view')->withBoard($boardData);
Render with:
@board($boardData)
Database-Driven Boards: Fetch board data from a DB table (e.g., boards) and pass it to the view:
$board = Board::find($id);
return view('board')->with('board', $board);
Card Templates: Extend the default card rendering by publishing the view:
php artisan vendor:publish --provider="Atm\BoardBundle\AtmBoardBundle" --tag=views
Override resources/views/vendor/atm_board/card.blade.php.
Card Data: Pass additional data to cards via the board config:
'columns' => [
'todo' => [
'title' => 'To-Do',
'cards' => [
['title' => 'Task 1', 'description' => 'Details...', 'status' => 'pending'],
],
],
],
Authorization: Use Laravel’s gates/policies to restrict board access:
Gate::define('view-board', function ($user, $board) {
return $user->canAccessBoard($board);
});
Check in Blade:
@can('view-board', $board)
@board($board)
@endcan
Events: Listen for board/card updates:
event(new \Atm\BoardBundle\Events\BoardUpdated($boardId));
Route::get('/api/boards/{id}', [BoardController::class, 'show']);
Return JSON:
return response()->json($boardData);
Asset Paths
public/vendor/atm_board/ directory exists and permissions are correct.php artisan view:clear
Config Merging
config/atm_board.php must merge with defaults. Use:
'boards' => array_merge($defaultBoards, [
'custom_board' => [...],
]),
Blade Directive Scope
@board directive requires the AtmBoardBundle service provider to be registered before the view is rendered. Place it early in config/app.php.Nested Data Issues
columns and cards arrays are properly structured. Validate with:
$this->validate($request, [
'columns.*' => 'array',
'columns.*.cards' => 'array',
]);
\Log::debug('Board config:', ['config' => config('atm_board.boards')]);
resources/views/vendor/atm_board/).Custom Directives
Extend the @board directive by binding a new one in AppServiceProvider:
Blade::directive('customBoard', function ($expression) {
return "<?php echo \Atm\BoardBundle\Board::renderCustom($expression); ?>";
});
Service Container Binding Bind a custom board resolver:
$this->app->bind(\Atm\BoardBundle\Contracts\BoardResolver::class, function () {
return new CustomBoardResolver();
});
Event Listeners
Subscribe to board events in EventServiceProvider:
protected $listen = [
\Atm\BoardBundle\Events\BoardUpdated::class => [
\App\Listeners\LogBoardUpdate::class,
],
];
Cache::remember('atm_board_config', now()->addHours(1), function () {
return config('atm_board.boards');
});
How can I help you explore Laravel packages today?