diff --git a/app/Casts/QuoteSyncCast.php b/app/Casts/QuoteSyncCast.php new file mode 100644 index 0000000000..8f413c179f --- /dev/null +++ b/app/Casts/QuoteSyncCast.php @@ -0,0 +1,52 @@ + null]; + } + + return [ + $key => json_encode([ + 'qb_id' => $value->qb_id, + ]) + ]; + + } +} diff --git a/app/DataMapper/QuoteSync.php b/app/DataMapper/QuoteSync.php new file mode 100644 index 0000000000..f1d7718951 --- /dev/null +++ b/app/DataMapper/QuoteSync.php @@ -0,0 +1,46 @@ +qb_id = $attributes['qb_id'] ?? ''; + + } + + /** + * Get the name of the caster class to use when casting from / to this cast target. + * + * @param array $arguments + */ + public static function castUsing(array $arguments): string + { + return QuoteSyncCast::class; + } + + public static function fromArray(array $data): self + { + return new self($data); + } +} diff --git a/app/Http/Controllers/EmailController.php b/app/Http/Controllers/EmailController.php index f17ab0c58e..1c9d7639fb 100644 --- a/app/Http/Controllers/EmailController.php +++ b/app/Http/Controllers/EmailController.php @@ -18,7 +18,6 @@ use App\Models\Invoice; use App\Models\Webhook; use App\Models\PurchaseOrder; use App\Services\Email\Email; -use App\DataMapper\InvoiceSync; use App\Utils\Traits\MakesHash; use App\Models\RecurringInvoice; use App\Services\Email\EmailObject; diff --git a/app/Models/Quote.php b/app/Models/Quote.php index 61126f769e..6addefc795 100644 --- a/app/Models/Quote.php +++ b/app/Models/Quote.php @@ -13,6 +13,7 @@ namespace App\Models; use App\Utils\Ninja; use App\Utils\Number; +use App\DataMapper\QuoteSync; use Laravel\Scout\Searchable; use Illuminate\Support\Carbon; use App\Utils\Traits\MakesHash; @@ -55,6 +56,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; * @property bool $is_deleted * @property array|null $line_items * @property object|null $backup + * @property object|null $sync * @property string|null $footer * @property string|null $public_notes * @property string|null $private_notes @@ -181,6 +183,8 @@ class Quote extends BaseModel 'is_deleted' => 'boolean', 'is_amount_discount' => 'bool', 'e_invoice' => 'object', + 'sync' => QuoteSync::class, + ]; public const STATUS_DRAFT = 1;