I cannot fill the forum data, although I mount it, the data with the relationship does not come here
namespace App\Livewire;
use App\Models\UserAddress;
use App\Models\City;
use App\Models\District;
use App\Models\UserInfo;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Auth;
use Jeffgreco13\FilamentBreezy\Livewire\MyProfileComponent;
use Livewire\Component;
use Parfaitementweb\FilamentCountryField\Forms\Components\Country;
class CustomUserEdit extends MyProfileComponent
{
protected string $view = "livewire.custom-user-edit";
public function mount(UserInfo $userInfo): void
{
$this->form->fill($userInfo->toArray());
}
public array $data;
public function form(Form $form): Form
{
return $form
->schema(
->maxLength(255),
TextInput::make('tc')
->required()->label(__('custom.tc'))
->maxLength(255)->numeric(),
TextInput::make('city')
->required()->label(__('custom.city'))
->maxLength(255),
TextInput::make('district')
->required()->label(__('custom.district'))
->maxLength(255),
TextInput::make('country')
->required()->label(__('custom.country'))
->maxLength(255),
TextInput::make('address')
->required()->label(__('custom.address'))
->maxLength(255), TextInput::make('zipcode')
->required()->label(__('custom.zipcode'))
->maxLength(255),
])
->statePath('data')
->model(UserInfo::class);
}
public function submit(){
$data=$this->form->getState();
$data['user_id']=Auth::id();
UserInfo::create($data);
}
}
namespace App\Livewire;
use App\Models\UserAddress;
use App\Models\City;
use App\Models\District;
use App\Models\UserInfo;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Auth;
use Jeffgreco13\FilamentBreezy\Livewire\MyProfileComponent;
use Livewire\Component;
use Parfaitementweb\FilamentCountryField\Forms\Components\Country;
class CustomUserEdit extends MyProfileComponent
{
protected string $view = "livewire.custom-user-edit";
public function mount(UserInfo $userInfo): void
{
$this->form->fill($userInfo->toArray());
}
public array $data;
public function form(Form $form): Form
{
return $form
->schema(
->maxLength(255),
TextInput::make('tc')
->required()->label(__('custom.tc'))
->maxLength(255)->numeric(),
TextInput::make('city')
->required()->label(__('custom.city'))
->maxLength(255),
TextInput::make('district')
->required()->label(__('custom.district'))
->maxLength(255),
TextInput::make('country')
->required()->label(__('custom.country'))
->maxLength(255),
TextInput::make('address')
->required()->label(__('custom.address'))
->maxLength(255), TextInput::make('zipcode')
->required()->label(__('custom.zipcode'))
->maxLength(255),
])
->statePath('data')
->model(UserInfo::class);
}
public function submit(){
$data=$this->form->getState();
$data['user_id']=Auth::id();
UserInfo::create($data);
}
}
2 Replies