mirror of
https://github.com/archtechx/virtualcolumn.git
synced 2025-12-18 15:44:03 +00:00
add virtual columns array
This commit is contained in:
parent
ab3f943990
commit
6ca7c419c2
3 changed files with 101 additions and 1 deletions
|
|
@ -45,7 +45,10 @@ trait VirtualColumn
|
|||
}
|
||||
|
||||
foreach ($model->getAttributes() as $key => $value) {
|
||||
if (! in_array($key, static::getCustomColumns())) {
|
||||
|
||||
if ((static::getVirtualColumns() && in_array($key, static::getVirtualColumns(), true))
|
||||
|| ! in_array($key, static::getCustomColumns())
|
||||
) {
|
||||
$current = $model->getAttribute(static::getDataColumn()) ?? [];
|
||||
|
||||
$model->setAttribute(static::getDataColumn(), array_merge($current, [
|
||||
|
|
@ -133,6 +136,13 @@ trait VirtualColumn
|
|||
return 'data';
|
||||
}
|
||||
|
||||
public static function getVirtualColumns(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCustomColumns(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue