Cannot store select options data in another table

Good day, in some modules it's working... but in this module is not working,, I want to add gender of the user but the userDetails is separate from users table code Resource
Forms\Components\Select::make('detail.gender')
->label('Gender')
->required()
->options(Gender::array())
->placeholder('Select Gender'),
Forms\Components\Select::make('detail.gender')
->label('Gender')
->required()
->options(Gender::array())
->placeholder('Select Gender'),
user model
public function detail(): HasOne
{
return $this->hasOne(UserDetail::class, 'id');
}
public function detail(): HasOne
{
return $this->hasOne(UserDetail::class, 'id');
}
UserDetail
<?php

namespace App\Models;

use App\Cache\UserDetail\UserDetailById;
use App\Enums\UserDetail\Gender;
use App\Models\Contracts\Cacheable;
use App\Observers\UserDetailObserver;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

#[ObservedBy([UserDetailObserver::class])]
class UserDetail extends Model implements Cacheable
{
use HasFactory;

protected $fillable = ['birthdate','gender'];

protected function casts(): array
{
return [
'birthdate' => 'date',
'gender' => Gender::class,
];
}

public function clearCache(): void
{
(new UserDetailById($this->id))->invalidate();
}
}
<?php

namespace App\Models;

use App\Cache\UserDetail\UserDetailById;
use App\Enums\UserDetail\Gender;
use App\Models\Contracts\Cacheable;
use App\Observers\UserDetailObserver;
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

#[ObservedBy([UserDetailObserver::class])]
class UserDetail extends Model implements Cacheable
{
use HasFactory;

protected $fillable = ['birthdate','gender'];

protected function casts(): array
{
return [
'birthdate' => 'date',
'gender' => Gender::class,
];
}

public function clearCache(): void
{
(new UserDetailById($this->id))->invalidate();
}
}
1 Reply
Solution
Want results from more Discord servers?
Add your server