1- # : package_description
1+ # Flowforge - Kanban Board for Laravel and Filament
22
3- [ ![ Latest Version on Packagist] ( https://img.shields.io/packagist/v/:vendor_slug/:package_slug .svg?style=flat-square )] ( https://packagist.org/packages/:vendor_slug/:package_slug )
4- [ ![ GitHub Tests Action Status] ( https://img.shields.io/github/actions/workflow/status/:vendor_slug/:package_slug /run-tests.yml?branch=main&label=tests&style=flat-square )] ( https://github.com/:vendor_slug/:package_slug /actions?query=workflow%3Arun-tests+branch%3Amain )
5- [ ![ GitHub Code Style Action Status] ( https://img.shields.io/github/actions/workflow/status/:vendor_slug/:package_slug /fix-php-code-styling.yml?branch=main&label=code%20style&style=flat-square )] ( https://github.com/:vendor_slug/:package_slug /actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain )
6- [ ![ Total Downloads] ( https://img.shields.io/packagist/dt/:vendor_slug/:package_slug .svg?style=flat-square )] ( https://packagist.org/packages/:vendor_slug/:package_slug )
3+ [ ![ Latest Version on Packagist] ( https://img.shields.io/packagist/v/relaticle/flowforge .svg?style=flat-square )] ( https://packagist.org/packages/relaticle/flowforge )
4+ [ ![ GitHub Tests Action Status] ( https://img.shields.io/github/actions/workflow/status/relaticle/flowforge /run-tests.yml?branch=main&label=tests&style=flat-square )] ( https://github.com/relaticle/flowforge /actions?query=workflow%3Arun-tests+branch%3Amain )
5+ [ ![ GitHub Code Style Action Status] ( https://img.shields.io/github/actions/workflow/status/relaticle/flowforge /fix-php-code-styling.yml?branch=main&label=code%20style&style=flat-square )] ( https://github.com/relaticle/flowforge /actions?query=workflow%3A"Fix+PHP+code+styling"+branch%3Amain )
6+ [ ![ Total Downloads] ( https://img.shields.io/packagist/dt/relaticle/flowforge .svg?style=flat-square )] ( https://packagist.org/packages/relaticle/flowforge )
77
8- <!-- delete-->
9- ---
10- This repo can be used to scaffold a Filament plugin. Follow these steps to get started:
8+ Flowforge is a lightweight Kanban board package for Laravel 11 and Filament 3 that works with existing Eloquent models. This package allows developers to transform any model with a status field into a Kanban board with minimal configuration, without requiring additional database tables.
119
12- 1 . Press the "Use this template" button at the top of this repo to create a new repo with the contents of this skeleton.
13- 2 . Run "php ./configure.php" to run a script that will replace all placeholders throughout all the files.
14- 3 . Make something great!
15- ---
16- <!-- /delete-->
10+ ## Features
1711
18- This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
12+ - Simple integration with existing Eloquent models
13+ - Drag-and-drop functionality between columns
14+ - Customizable card appearance
15+ - Filament 3 integration
16+ - Responsive design
17+ - Dark mode support
18+ - No additional database tables required
19+
20+ ## Requirements
21+
22+ - PHP 8.1 or higher
23+ - Laravel 11.x
24+ - Filament 3.x
1925
2026## Installation
2127
2228You can install the package via composer:
2329
2430``` bash
25- composer require :vendor_slug/:package_slug
31+ composer require relaticle/flowforge
2632```
2733
28- You can publish and run the migrations with:
34+ The package will automatically register its service provider if you're using Laravel's package auto-discovery.
2935
30- ``` bash
31- php artisan vendor:publish --tag=" :package_slug-migrations"
32- php artisan migrate
36+ ## Usage
37+
38+ ### 1. Add the trait to your model
39+
40+ Add the ` HasKanbanBoard ` trait to any Eloquent model you want to display on a Kanban board:
41+
42+ ``` php
43+ use Relaticle\Flowforge\Traits\HasKanbanBoard;
44+
45+ class Task extends Model
46+ {
47+ use HasFactory;
48+ use HasKanbanBoard;
49+
50+ protected $fillable = [
51+ 'title',
52+ 'description',
53+ 'status',
54+ 'priority',
55+ 'due_date',
56+ ];
57+
58+ /**
59+ * Get the status values for the task.
60+ *
61+ * @return array<string , string >
62+ */
63+ public static function getStatusOptions(): array
64+ {
65+ return [
66+ 'todo' => 'To Do',
67+ 'in_progress' => 'In Progress',
68+ 'review' => 'In Review',
69+ 'done' => 'Done',
70+ ];
71+ }
72+ }
3373```
3474
35- You can publish the config file with:
75+ ### 2. Create a Kanban board page in your Filament resource
3676
37- ``` bash
38- php artisan vendor:publish --tag=" :package_slug-config"
77+ Create a new page that extends the ` KanbanBoard ` class:
78+
79+ ``` php
80+ namespace App\Filament\Resources\TaskResource\Pages;
81+
82+ use App\Filament\Resources\TaskResource;
83+ use App\Models\Task;
84+ use Relaticle\Flowforge\Filament\Resources\Pages\KanbanBoard;
85+
86+ class TaskKanbanBoard extends KanbanBoard
87+ {
88+ protected static string $resource = TaskResource::class;
89+
90+ public function mount(): void
91+ {
92+ parent::mount();
93+
94+ $this->statusField('status')
95+ ->statusValues(Task::getStatusOptions())
96+ ->titleAttribute('title')
97+ ->descriptionAttribute('description')
98+ ->cardAttributes([
99+ 'priority' => 'Priority',
100+ 'due_date' => 'Due Date',
101+ ]);
102+ }
103+
104+ protected function getHeaderActions(): array
105+ {
106+ return [
107+ \Filament\Actions\Action::make('back_to_list')
108+ ->label('Back to List')
109+ ->url(fn (): string => TaskResource::getUrl('index'))
110+ ->icon('heroicon-o-arrow-left'),
111+ ];
112+ }
113+ }
39114```
40115
41- Optionally, you can publish the views using
116+ ### 3. Register the Kanban board page in your resource
42117
43- ``` bash
44- php artisan vendor:publish --tag=" :package_slug-views"
118+ Add the Kanban board page to your resource's ` getPages ` method:
119+
120+ ``` php
121+ public static function getPages(): array
122+ {
123+ return [
124+ 'index' => Pages\ListTasks::route('/'),
125+ 'create' => Pages\CreateTask::route('/create'),
126+ 'edit' => Pages\EditTask::route('/{record}/edit'),
127+ 'kanban' => Pages\TaskKanbanBoard::route('/kanban'),
128+ ];
129+ }
45130```
46131
47- This is the contents of the published config file:
132+ ### 4. Add a link to the Kanban board in your resource's list page
133+
134+ Add a header action to navigate to the Kanban board:
48135
49136``` php
50- return [
51- ];
137+ protected function getHeaderActions(): array
138+ {
139+ return [
140+ Actions\CreateAction::make(),
141+ Actions\Action::make('kanban')
142+ ->label('Kanban Board')
143+ ->url(fn (): string => TaskResource::getUrl('kanban'))
144+ ->icon('heroicon-o-view-columns')
145+ ->color('success'),
146+ ];
147+ }
52148```
53149
54- ## Usage
150+ ## Advanced Usage
151+
152+ ### Standalone Kanban Board Page
153+
154+ You can also create a standalone Kanban board page that's not tied to a specific resource:
155+
156+ ``` php
157+ namespace App\Filament\Pages;
158+
159+ use App\Models\Task;
160+ use Relaticle\Flowforge\Filament\Pages\KanbanBoardPage;
161+
162+ class TasksKanbanBoard extends KanbanBoardPage
163+ {
164+ protected static ?string $navigationIcon = 'heroicon-o-view-columns';
165+ protected static ?string $navigationLabel = 'Tasks Kanban';
166+ protected static ?string $title = 'Tasks Kanban Board';
167+
168+ public function mount(): void
169+ {
170+ $this->adapter(Task::kanban(
171+ 'status',
172+ Task::getStatusOptions(),
173+ 'title',
174+ 'description',
175+ [
176+ 'priority' => 'Priority',
177+ 'due_date' => 'Due Date',
178+ ]
179+ ));
180+
181+ parent::mount();
182+ }
183+ }
184+ ```
185+
186+ ### Custom Adapter
187+
188+ You can create a custom adapter by implementing the ` IKanbanAdapter ` interface:
55189
56190``` php
57- $variable = new VendorName\Skeleton();
58- echo $variable->echoPhrase('Hello, VendorName!');
191+ namespace App\Kanban;
192+
193+ use Illuminate\Database\Eloquent\Model;
194+ use Illuminate\Support\Collection;
195+ use Relaticle\Flowforge\Contracts\IKanbanAdapter;
196+
197+ class CustomKanbanAdapter implements IKanbanAdapter
198+ {
199+ protected Model $model;
200+ protected string $statusField;
201+ protected array $statusValues;
202+ protected string $titleAttribute;
203+ protected ?string $descriptionAttribute;
204+ protected array $cardAttributes;
205+
206+ public function __construct(
207+ Model $model,
208+ string $statusField,
209+ array $statusValues,
210+ string $titleAttribute,
211+ ?string $descriptionAttribute = null,
212+ array $cardAttributes = []
213+ ) {
214+ $this->model = $model;
215+ $this->statusField = $statusField;
216+ $this->statusValues = $statusValues;
217+ $this->titleAttribute = $titleAttribute;
218+ $this->descriptionAttribute = $descriptionAttribute;
219+ $this->cardAttributes = $cardAttributes;
220+ }
221+
222+ // Implement the interface methods
223+ // ...
224+ }
225+ ```
226+
227+ ### Customizing the Card Appearance
228+
229+ You can customize the appearance of the cards by publishing the views:
230+
231+ ``` bash
232+ php artisan vendor:publish --tag=" flowforge-views"
233+ ```
234+
235+ ## Configuration
236+
237+ You can publish the configuration file with:
238+
239+ ``` bash
240+ php artisan vendor:publish --tag=" flowforge-config"
241+ ```
242+
243+ This will publish a ` flowforge.php ` configuration file to your config directory.
244+
245+ ## Styling
246+
247+ The package comes with default styling that integrates well with Filament's design system. You can customize the styling by publishing the CSS:
248+
249+ ``` bash
250+ php artisan vendor:publish --tag=" flowforge-assets"
59251```
60252
61253## Testing
@@ -78,7 +270,7 @@ Please review [our security policy](../../security/policy) on how to report secu
78270
79271## Credits
80272
81- - [ : author_name ] ( https://github.com/:author_username )
273+ - [ manukminasyan ] ( https://github.com/Relaticle )
82274- [ All Contributors] ( ../../contributors )
83275
84276## License
0 commit comments