1
0
Fork 0
mirror of https://github.com/archtechx/virtualcolumn.git synced 2025-12-12 18:44: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,12 +140,25 @@ class VirtualColumnTest extends TestCase
} }
} }
class MyModel extends Model class ParentModel extends Model
{ {
use VirtualColumn; use VirtualColumn;
protected $guarded = []; protected $guarded = [];
public $timestamps = false; public $timestamps = false;
public function getCustomColumns(): array
{
return [
'id',
'custom1',
'custom2',
];
}
}
class MyModel extends ParentModel
{
public $casts = [ public $casts = [
'password' => 'encrypted', 'password' => 'encrypted',
'array' => 'encrypted:array', 'array' => 'encrypted:array',
@ -154,34 +167,11 @@ class MyModel extends Model
'object' => 'encrypted:object', 'object' => 'encrypted:object',
'custom' => EncryptedCast::class, 'custom' => EncryptedCast::class,
]; ];
public static function getCustomColumns(): array
{
return [
'id',
'custom1',
'custom2',
];
}
} }
class FooModel extends Model class FooModel extends ParentModel
{ {
use VirtualColumn; public function getDataColumn(): string
protected $guarded = [];
public $timestamps = false;
public static function getCustomColumns(): array
{
return [
'id',
'custom1',
'custom2',
];
}
public static function getDataColumn(): string
{ {
return 'virtual'; return 'virtual';
} }