Expose product price in API

This commit is contained in:
David Bomba 2019-09-26 09:47:33 +10:00
parent 1778e63421
commit e21d425093
2 changed files with 6 additions and 6 deletions

View File

@ -143,15 +143,14 @@ class MultiDB
public static function findAndSetDbByDomain($domain) :bool public static function findAndSetDbByDomain($domain) :bool
{ {
\Log::error("searching for {$domain}"); //\Log::error("searching for {$domain}");
foreach (self::$dbs as $db) foreach (self::$dbs as $db)
{ {
$company = Company::on($db)->whereDomain($domain)->first();
\Log::error($company);
if($company = Company::on($db)->whereDomain($domain)->first()) if($company = Company::on($db)->whereDomain($domain)->first())
{ {
\Log::error("setting db");
self::setDb($company->db); self::setDb($company->db);
return true; return true;

View File

@ -63,6 +63,7 @@ class ProductTransformer extends EntityTransformer
'product_key' => $product->product_key, 'product_key' => $product->product_key,
'notes' => $product->notes, 'notes' => $product->notes,
'cost' => (float) $product->cost, 'cost' => (float) $product->cost,
'price' => (float) $product->price,
'quantity' => (float) ($product->quantity ?: 0.0), 'quantity' => (float) ($product->quantity ?: 0.0),
'tax_name1' => $product->tax_name1 ?: '', 'tax_name1' => $product->tax_name1 ?: '',
'tax_rate1' => (float) $product->tax_rate1, 'tax_rate1' => (float) $product->tax_rate1,
@ -72,8 +73,8 @@ class ProductTransformer extends EntityTransformer
'archived_at' => $product->deleted_at, 'archived_at' => $product->deleted_at,
'custom_value1' => $product->custom_value1 ?: '', 'custom_value1' => $product->custom_value1 ?: '',
'custom_value2' => $product->custom_value2 ?: '', 'custom_value2' => $product->custom_value2 ?: '',
'custom_value3' => $product->custom_value2 ?: '', 'custom_value3' => $product->custom_value3 ?: '',
'custom_value4' => $product->custom_value2 ?: '', 'custom_value4' => $product->custom_value4 ?: '',
'is_deleted' => (bool) $product->is_deleted, 'is_deleted' => (bool) $product->is_deleted,
]; ];
} }