1
0
Fork 0
mirror of https://github.com/archtechx/virtualcolumn.git synced 2025-12-12 18:44:04 +00:00

feat: Add new column for "foo_child" table to link with the table "foo".

- Add to Virtual Column a new rule to prevent store relationships names in the "data" column.
This commit is contained in:
Henrique Felix 2025-05-12 17:23:27 +00:00
parent 75718edcfe
commit dda54ddab0
3 changed files with 44 additions and 0 deletions

View file

@ -76,6 +76,15 @@ trait VirtualColumn
// Remove attribute from the model
unset($this->attributes[$key]);
unset($this->original[$key]);
// Check if the attribute is a method on the model
$myKeyIsAnFunction = method_exists($this, $key);
// If the attribute is a method, remove it from the attributes array
// This is to prevent the attribute from being added to the data column
if ($myKeyIsAnFunction) {
unset($attributes[$key]);
}
}
// Add attribute to the data column