main

filamentphp/demo

Last updated at: 29/12/2023 09:42

RegisterTeam.php

TLDR

This file, RegisterTeam.php, is a subclass of the RegisterTenant class and is part of the Demo Projects project. It defines a form for registering a new team and provides a label for the form.

Classes

RegisterTeam

The RegisterTeam class is a subclass of the RegisterTenant class. It defines a form for registering a new team and provides a label for the form.

  • getLabel(): string: Returns the label for the form as a string.
  • form(Form $form): Form: Takes a Form object as a parameter and returns the updated Form object after adding a schema to it. The schema includes a TextInput component for the team name, marked as required.
<?php

namespace App\Filament\App\Pages;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Pages\Tenancy\RegisterTenant;

class RegisterTeam extends RegisterTenant
{
    public static function getLabel(): string
    {
        return 'New team';
    }

    public function form(Form $form): Form
    {
        return $form
            ->schema([
                TextInput::make('name')->required(),
            ]);
    }
}