How can i add one more column in Product view table

Laraship QuestionsCategory: TechnicalHow can i add one more column in Product view table
SANDEEP AGGARWAL asked 3 years ago
Hi sir, Actually we need to add product inventory count in product view table. Please can you explain how can i add or display product inventory count in front of show table.
1 Answers
laraship Staff answered 3 years ago
Hello, Please follow the steps to add new columns to datatables : https://www.laraship.com/docs/laraship/laraship-configuration/tables-configuration/
stock is saved under SKUs with json field :"inventory" ,  you can find quantity and stock status there.
SANDEEP AGGARWAL replied 3 years ago

Thank you for your response

Little bit confused and I can’t find out where i get inventory count and query .

I place below code in ‘ Corals/modules/marketplace/Transformers/ProductTransformer.php’

‘stock_count’ => $product->inventory->stock,

my humble request to you to check and let me know this is the correct format otherwise guide me and where i place the code.

laraship Staff replied 3 years ago

Hello,
As mentioned earlier the stock is saved inside json field so you need to check laravel documentation how to grab the data from there