Add casts for location model
This commit is contained in:
parent
2bebfb0b85
commit
35f4aec6e3
|
|
@ -50,6 +50,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property string|null $custom_value4
|
||||
* @property bool $is_deleted
|
||||
* @property bool $is_shipping_location
|
||||
* @property object|array|null $tax_data
|
||||
* @property int|null $created_at
|
||||
* @property int|null $updated_at
|
||||
* @property int|null $deleted_at
|
||||
|
|
@ -91,6 +92,13 @@ class Location extends BaseModel
|
|||
'is_shipping_location',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'tax_data' => 'object',
|
||||
'updated_at' => 'timestamp',
|
||||
'created_at' => 'timestamp',
|
||||
'deleted_at' => 'timestamp',
|
||||
'is_deleted' => 'bool',
|
||||
];
|
||||
|
||||
protected $touches = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class ClientTransformer extends EntityTransformer
|
|||
'contacts',
|
||||
'documents',
|
||||
'gateway_tokens',
|
||||
'locations',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
@ -44,7 +45,6 @@ class ClientTransformer extends EntityTransformer
|
|||
'ledger',
|
||||
'system_logs',
|
||||
'group_settings',
|
||||
'locations',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ class LocationTransformer extends EntityTransformer
|
|||
'custom_value3' => $location->custom_value3 ?: '',
|
||||
'custom_value4' => $location->custom_value4 ?: '',
|
||||
'is_deleted' => (bool) $location->is_deleted,
|
||||
'tax_data' => $location->tax_data ?: new \stdClass(),
|
||||
'updated_at' => (int) $location->updated_at,
|
||||
'archived_at' => (int) $location->deleted_at,
|
||||
'created_at' => (int) $location->created_at,
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ return new class extends Migration
|
|||
$table->text('custom_value3')->nullable();
|
||||
$table->text('custom_value4')->nullable();
|
||||
|
||||
$table->mediumText('tax_data')->nullable();
|
||||
|
||||
$table->softDeletes('deleted_at', 6);
|
||||
$table->timestamps(6);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue