solutionforest / filament-tab-plugin

MIT License
15 stars 1 forks source link

getData how do you receive in component? #4

Closed faizananwerali closed 1 year ago

faizananwerali commented 1 year ago
<?php

namespace App\Filament\Tabs\Components;

use Filament\Widgets\FilamentInfoWidget as ComponentTabComponent;
use SolutionForest\TabLayoutPlugin\Components\Tabs\TabLayoutComponent;

class FilamentInfoWidget extends TabLayoutComponent
{
    protected ?string $component = ComponentTabComponent::class;

    public function getData(): array
    {
        return [
            // Data to assign to a component
        ];
    }
}

here you can send data, but how do you receive it in the component?

lam0819 commented 1 year ago

You can follow the instruction. But we will achieve this project since filament3 support tabs now. https://beta.filamentphp.com/docs/3.x/infolists/layout/tabs

You can also use the php artisan tab-layout:component command to generate the code for a new tab layout component. For example, to generate a FilamentInfoWidget component, you can run the following command:

php artisan tab-layout:component FilamentInfoWidget Filament\Widgets\FilamentInfoWidget After creating your custom tab layout component by extending the TabLayoutComponent class, you can register it on the schema of a TabLayoutTab instance.

protected function schema(): array { return [ ... TabLayoutTab::make('Label 3') ->schema([ App\Filament\Tabs\Components\FilamentInfoWidget::make() // ->data([]), // Also can assign data here ]), ]; }