PHP code example of leonardo-max / livewire-kanban-board

1. Go to this page and download the library: Download leonardo-max/livewire-kanban-board 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/ */

    

leonardo-max / livewire-kanban-board example snippets


public function statuses() : Collection 
{
    //
}

public function records() : Collection 
{
    //
}

public function statuses() : Collection
{
    return collect([
        [
            'id' => 'registered',
            'title' => 'Registered',
        ],
        [
            'id' => 'awaiting_confirmation',
            'title' => 'Awaiting Confirmation',
        ],
        [
            'id' => 'confirmed',
            'title' => 'Confirmed',
        ],
        [
            'id' => 'delivered',
            'title' => 'Delivered',
        ],
    ]);
}

public function records() : Collection
{
    return SalesOrder::query()
        ->map(function (SalesOrder $salesOrder) {
            return [
                'id' => $salesOrder->id,
                'title' => $salesOrder->client,
                'status' => $salesOrder->status,
            ];
        });
}

$status['id'] == $record['status'];

public function onStatusSorted($recordId, $statusId, $orderedIds)
{
    //   
}

public function onStatusChanged($recordId, $statusId, $fromOrderedIds, $toOrderedIds)
{
    //
}

public function onRecordClick($recordId)
{
    //
}

return [
    'wrapper' => 'd-flex flex-nowrap overflow-x-auto rounded', // component wrapper
    'statusWrapper' => 'flex-shrink-0', // statuses wrapper
    'statusWidth' => 272, // statuses column width
    'status' => 'flex-column rounded bg-primary fw-bold mx-1 px-2', // status column wrapper 
    'statusHeader' => 'py-2 fs-5', // status header
    'statusFooter' => '', // status footer
    'statusRecords' => '', // status records wrapper 
    'record' => 'bg-white shadow rounded border fw-normal p-2 my-2', // record wrapper
    'recordContent' => '', // record content
];

public function styles()
{
    $baseStyles = parent::styles();

    $baseStyles['wrapper'] = 'd-flex flex-nowrap overflow-x-auto rounded';

    $baseStyles['statusWrapper'] = 'flex-shrink-0';

    $baseStyles['statusWidth'] = 300;

    $baseStyles['status'] = 'flex-column rounded bg-primary fw-bold mx-1 px-2';

    $baseStyles['statusHeader'] = 'py-2 fs-5';

    $baseStyles['statusRecords'] = 'overflow-y-auto';

    $baseStyles['record'] = 'bg-white shadow rounded border fw-normal p-2 my-2';

    return $baseStyles;
}
 bash
php artisan make:livewire SalesOrdersKanbanBoard