You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If the model has an incrementing key, we can use the "insertGetId" method on
// the query builder, which will give us back the final inserted ID for this
// table from the database. Not all tables have to be incrementing though.
$attributes = $this->getAttributes();
if ($this->getIncrementing()) {
$this->insertAndSetId($query, $attributes);
}
seems like we need to add this code to Favorite model
public function getIncrementing()
{
return null;
}
Missing column
id
in default favorites table migrationwhen i try to add some model to favorites it generates following query, which requires
id
columnSQL: insert into "favorites" ("user_id", "favoriteable_id", "favoriteable_type", "updated_at", "created_at") values (1, 2, App\Models\Institution\Institution, 2021-04-19 06:19:59, 2021-04-19 06:19:59) returning "id"
i dont really realize why and where this is happening, i guess it has something to do with relationtship registration
Possible implementation
add id column to default migration, or figure out why eloquent adds
requiring "id"
to its query and get rid of itMy environment
The text was updated successfully, but these errors were encountered: