diff --git a/app/Models/Location.php b/app/Models/Location.php index 797434a172..e7307ed0b8 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -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 = []; diff --git a/app/Transformers/ClientTransformer.php b/app/Transformers/ClientTransformer.php index 426a4053f7..02036b4836 100644 --- a/app/Transformers/ClientTransformer.php +++ b/app/Transformers/ClientTransformer.php @@ -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', ]; /** diff --git a/app/Transformers/LocationTransformer.php b/app/Transformers/LocationTransformer.php index 611632ec94..4e12388c96 100644 --- a/app/Transformers/LocationTransformer.php +++ b/app/Transformers/LocationTransformer.php @@ -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, diff --git a/database/migrations/2025_02_20_224129_entity_location_schema.php b/database/migrations/2025_02_20_224129_entity_location_schema.php index 41e22944ed..56fbf3ae8e 100644 --- a/database/migrations/2025_02_20_224129_entity_location_schema.php +++ b/database/migrations/2025_02_20_224129_entity_location_schema.php @@ -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);