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

Add base class that uses VirtualColumn in tests

This commit is contained in:
lukinovec 2023-10-17 09:47:09 +02:00
parent 8b6db9ac2a
commit 56620956da

View file

@ -140,22 +140,14 @@ class VirtualColumnTest extends TestCase
}
}
class MyModel extends Model
class ParentModel extends Model
{
use VirtualColumn;
protected $guarded = [];
public $timestamps = false;
public $casts = [
'password' => 'encrypted',
'array' => 'encrypted:array',
'collection' => 'encrypted:collection',
'json' => 'encrypted:json',
'object' => 'encrypted:object',
'custom' => EncryptedCast::class,
];
public static function getCustomColumns(): array
public function getCustomColumns(): array
{
return [
'id',
@ -165,23 +157,21 @@ class MyModel extends Model
}
}
class FooModel extends Model
class MyModel extends ParentModel
{
use VirtualColumn;
public $casts = [
'password' => 'encrypted',
'array' => 'encrypted:array',
'collection' => 'encrypted:collection',
'json' => 'encrypted:json',
'object' => 'encrypted:object',
'custom' => EncryptedCast::class,
];
}
protected $guarded = [];
public $timestamps = false;
public static function getCustomColumns(): array
{
return [
'id',
'custom1',
'custom2',
];
}
public static function getDataColumn(): string
class FooModel extends ParentModel
{
public function getDataColumn(): string
{
return 'virtual';
}