File: /home/posscale/www/printmanager/app/Http/Livewire/TenantAction.php
<?php
namespace App\Http\Livewire;
use App\Models\Tenant;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\RichEditor;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Livewire\Component;
use Filament\Forms\Form;
class TenantAction extends Component implements HasForms
{
use InteractsWithForms;
public Tenant $tenant;
public bool $codeRequested = false;
public function mount($tenant): void
{
// $this->tenant = $tenant;
$this->form->fill();
}
public function actionForm(Form $form): Form
{
return $form
->schema([
TextInput::make('name')->required()->hidden($this->codeRequested),
TextInput::make('phone')->required()->hidden($this->codeRequested),
TextInput::make('code')
->required($this->codeRequested)
->visible($this->codeRequested),
])
->statePath('data');
}
public function render()
{
return view('livewire.tenant-action');
}
}