PHP code example of jinoantony / laravel-kanban

1. Go to this page and download the library: Download jinoantony/laravel-kanban 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/ */

    

jinoantony / laravel-kanban example snippets


JinoAntony\Kanban\LaravelKanbanServiceProvider::class,

class TaskKanban extends Kanban
{
    /**
     * Get the list of boards
     *
     * @return KBoard[]
     */
    public function getBoards()
    {
        return [
            KBoard::make('board1')
                ->setTitle('Board1 title')
                ->canDragTo('board2'),

            KBoard::make('board2')
                ->setTitle('Board2 title')
                ->canDragTo('board3'),

            KBoard::make('board3')
                ->setTitle('Board3 title')
                ->canDragTo('board2')
                ->canDragTo('board1'),
        ];
    }

    /**
     * Get the data for each board
     *
     * @return array
     */
    public function data()
    {
        return [
            'board1' => [
                KItem::make('1')
                    ->setContent('Item1'),
                KItem::make('2')
                    ->setContent('Item2'),
            ],
            'board2' => [
                KItem::make('3')
                    ->setContent('Item3'),
                KItem::make('4')
                    ->setContent('Item4'),
            ],
            'board3' => [
                KItem::make('5')
                    ->setContent('Item5'),
                KItem::make('6')
                    ->setContent('Item6'),
            ],
        ];
    }

    public function build()
    {
        return $this->element('.kanban-board')
            ->margin('20px')
            ->width('365px');
    }

}

use App\Kanban\TaskKanban;

class TaskController extends Controller
{
    public function get(TaskKanban $kanban)
    {
        return $kanban->render('kanban');
    }
}

Route::get('task', 'TaskController@get');
shell
php artisan kanban:make TaskKanban