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 string|null $custom_value4
|
||||||
* @property bool $is_deleted
|
* @property bool $is_deleted
|
||||||
* @property bool $is_shipping_location
|
* @property bool $is_shipping_location
|
||||||
|
* @property object|array|null $tax_data
|
||||||
* @property int|null $created_at
|
* @property int|null $created_at
|
||||||
* @property int|null $updated_at
|
* @property int|null $updated_at
|
||||||
* @property int|null $deleted_at
|
* @property int|null $deleted_at
|
||||||
|
|
@ -91,6 +92,13 @@ class Location extends BaseModel
|
||||||
'is_shipping_location',
|
'is_shipping_location',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $casts = [
|
||||||
|
'tax_data' => 'object',
|
||||||
|
'updated_at' => 'timestamp',
|
||||||
|
'created_at' => 'timestamp',
|
||||||
|
'deleted_at' => 'timestamp',
|
||||||
|
'is_deleted' => 'bool',
|
||||||
|
];
|
||||||
|
|
||||||
protected $touches = [];
|
protected $touches = [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ class ClientTransformer extends EntityTransformer
|
||||||
'contacts',
|
'contacts',
|
||||||
'documents',
|
'documents',
|
||||||
'gateway_tokens',
|
'gateway_tokens',
|
||||||
|
'locations',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -44,7 +45,6 @@ class ClientTransformer extends EntityTransformer
|
||||||
'ledger',
|
'ledger',
|
||||||
'system_logs',
|
'system_logs',
|
||||||
'group_settings',
|
'group_settings',
|
||||||
'locations',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ class LocationTransformer extends EntityTransformer
|
||||||
'custom_value3' => $location->custom_value3 ?: '',
|
'custom_value3' => $location->custom_value3 ?: '',
|
||||||
'custom_value4' => $location->custom_value4 ?: '',
|
'custom_value4' => $location->custom_value4 ?: '',
|
||||||
'is_deleted' => (bool) $location->is_deleted,
|
'is_deleted' => (bool) $location->is_deleted,
|
||||||
|
'tax_data' => $location->tax_data ?: new \stdClass(),
|
||||||
'updated_at' => (int) $location->updated_at,
|
'updated_at' => (int) $location->updated_at,
|
||||||
'archived_at' => (int) $location->deleted_at,
|
'archived_at' => (int) $location->deleted_at,
|
||||||
'created_at' => (int) $location->created_at,
|
'created_at' => (int) $location->created_at,
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ return new class extends Migration
|
||||||
$table->text('custom_value3')->nullable();
|
$table->text('custom_value3')->nullable();
|
||||||
$table->text('custom_value4')->nullable();
|
$table->text('custom_value4')->nullable();
|
||||||
|
|
||||||
|
$table->mediumText('tax_data')->nullable();
|
||||||
|
|
||||||
$table->softDeletes('deleted_at', 6);
|
$table->softDeletes('deleted_at', 6);
|
||||||
$table->timestamps(6);
|
$table->timestamps(6);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue