Solved it, just had to use a second array with the needed attributes.
->save($tag, [priority => 1]);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a similiar many to many plymorhpic structure to this
posts
id - integer
name - string
videos
id - integer
name - string
tags
id - integer
name - string
taggables
tag_id - integer
taggable_id - integer
taggable_type - string
/* CUSTOM */
custom_entry - string
priority - integer
expect I have two additional columns in taggables, custom_entry and priority. How can I fill those two columns with Eloquent?
I tried to manipulate the $tag value and added
$tag->custom_entry = "Random string";
$tag->priority = 1;
$video->tags()->save($tag);
but if I try to save I receive an error that those two columns are missing in my tags table. So how can I insert them in taggables table?
Solved it, just had to use a second array with the needed attributes.
->save($tag, [priority => 1]);
Please or to participate in this conversation.