same fields, different content

Hello, guys, I'm trying to make a form in which the user must enter a title and content in each tab according to the language. The problem is that if I write in a field it appears in each tab. How can I make filament recognize that they are different fields but also part of the same model? I am doing it this way because I am using astronomic translatable
No description
No description
3 Replies
awcodes
awcodes14mo ago
You need different names for the fields. An html form can’t have more than one ‘title’ field for example.
DrByte
DrByte14mo ago
and to add to what awcodes said, your duplicate title fields also can't be part of the same model. If it's actually a relationship to multiple tables, then your field names need to reflect the relationship. Does your translatable package have relations that you're using to store the data separately? or is it all in a JSON object (if it's all JSON then you'll have to model it differently)
MoisesSegura
MoisesSeguraOP14mo ago
this is the post model: class Post extends Model implements TranslatableContract{ use HasFactory; use HasTags; use Translatable; // 3. To define which attributes needs to be translated public $translatedAttributes = ['title','content']; protected $fillable = ['name']; / @var string/ protected $table = 'blog_posts';/ @var array<string, string>/ protected $casts = ['published_at' => 'date',]; public function author(): BelongsTo{ return $this->belongsTo(Author::class, 'blog_author_id');} public function category(): BelongsTo{ return $this->belongsTo(Category::class, 'blog_category_id');} public function comments(): MorphMany{ return $this->morphMany(Comment::class, 'commentable');} } and the translations model: class PostTranslation extends Model { use HasFactory; protected $table = 'blog_post_translations'; protected $fillable = ['title', 'content']; public $timestamps = false; } It is supposed to save all the translations in the same column, if I add them manually in the database I can filter them in filament so the models are properly related,
No description
No description
Want results from more Discord servers?
Add your server