PHP code example of qalainau / filament-univer-sheet

1. Go to this page and download the library: Download qalainau/filament-univer-sheet 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/ */

    

qalainau / filament-univer-sheet example snippets


use Qalainau\UniverSheet\UniverSheetPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugins([
            UniverSheetPlugin::make(),
        ]);
}

use Qalainau\UniverSheet\SpreadsheetField;

public static function form(Schema $schema): Schema
{
    return $schema
        ->components([
            SpreadsheetField::make('data')
                ->columnSpanFull(),
        ]);
}

SpreadsheetField::make('data')
    ->height('600px')
    ->minHeight('400px')
    ->showToolbar(false)
    ->showFormulaBar(false)
    ->showSheetTabs(false)
    ->showHeaderBar(false)
    ->showContextMenu(false)
    ->ribbonType('collapsed') // 'collapsed', 'simple', or 'classic'
    ->columnSpanFull(),

use Qalainau\UniverSheet\SpreadsheetEntry;

public static function infolist(Schema $schema): Schema
{
    return $schema
        ->components([
            SpreadsheetEntry::make('data')
                ->height('500px')
                ->columnSpanFull(),
        ]);
}

use Qalainau\UniverSheet\SpreadsheetColumn;

public static function table(Table $table): Table
{
    return $table
        ->columns([
            SpreadsheetColumn::make('data')
                ->previewRows(6)
                ->previewColumns(5),
        ]);
}

// Migration
Schema::create('spreadsheets', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->longText('data')->nullable();
    $table->timestamps();
});

// Model
protected $fillable = ['name', 'data'];

protected function casts(): array
{
    return [
        'data' => 'json',
    ];
}

UniverSheetPlugin::make()
    ->showToolbar(false)
    ->showFormulaBar(false)
    ->showSheetTabs(false)
    ->showHeaderBar(false)
    ->showContextMenu(false)
    ->ribbonType('collapsed')
    ->locale('ja-JP'),

return [
    'show_toolbar' => true,
    'show_formula_bar' => true,
    'show_sheet_tabs' => true,
    'show_header_bar' => true,
    'show_context_menu' => true,
    'ribbon_type' => null, // 'collapsed', 'simple', or 'classic'
    'locale' => 'en-US',
];
bash
php artisan filament:assets
bash
php artisan vendor:publish --tag=filament-univer-sheet-config
bash
php artisan filament:assets
bash
php artisan test --testsuite=UniverSheet