Panels

Belich incorporates the option to group the fields into panels. An example would be:

use Daguilarm\Belich\Fields\Types\Boolean;
use Daguilarm\Belich\Fields\Types\ID;
use Daguilarm\Belich\Fields\Types\Select;
use Daguilarm\Belich\Fields\Types\Panels;
use Daguilarm\Belich\Fields\Types\Text;
use Daguilarm\Belich\Fields\Types\TextArea;

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return Illuminate\Support\Collection
 */
public function fields(Request $request) {
    return [
        Panels::create('Billing Info', function() {
            return [
                ID::make('Id'),
                Text::make('Billing name', 'billing_name')
                    ->sortable()
                    ->rules('required'),
                Boolean::make('Status', 'billing_status')
                    ->sortable(),
                Text::make('N.I.F.', 'billing_nif')
                    ->sortable()
                    ->rules('required'),
            ];
        }),
        Panels::create('Personal info', function() {
            return [
                Text::make('Telephone', 'billing_telephone')
                    ->sortable()
                    ->rules('required'),
                Text::make('Address', 'billing_address')
                    ->sortable()
                    ->rules('required'),
                TextArea::make('Telephone2', 'billing_telephone')
                    ->count(200)
                    ->rules('required')
                    ->addClass('testing-class')
            ];
        }),
    ];
}

Showing on screen:

Panels

fig 3: Fields grouped in panels

The panels are displayed in all views except the index

They also offer us the option to customize the color of the background and the text, since the titles of the panels are generated by a Header field, and therefore, we can customize it. To do this, we will add the background color and the color of the text, as follows:

use Daguilarm\Belich\Fields\Types\ID;
use Daguilarm\Belich\Fields\Types\Panels;
use Daguilarm\Belich\Fields\Types\Text;

/**
 * Get the fields displayed by the resource.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return Illuminate\Support\Collection
 */
public function fields(Request $request) {
    return [
        Panels::create('Billing Info', function() {
            return [
                ID::make('Id'),
                Text::make('Billing name', 'billing_name')
                    ->sortable()
                    ->rules('required'),
            ];
        }, $background = 'teal-700', $color = 'white'),
    ];
}

That is, the structure of a Panel field is:

Panels::create(string $label, callable $fields, ?string $background, ?string $color);