<?php

namespace App\Http\Controllers\API\Stock\DataRoasting;

use App\DataRoasting;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class IndexController extends Controller
{
    public function getDataRoasting()
    {
        $data = DataRoasting::leftJoin('history_stocks', 'history_stocks.id', '=', 'data_roastings.history_stock_id')
            ->leftJoin('master_inventories', 'master_inventories.id', '=', 'history_stocks.product_id')
            ->select('master_inventories.name', 'history_stocks.stock_last', 'history_stocks.stock_out', 'history_stocks.stock_update', 'history_stocks.description', 'history_stocks.date', 'data_roastings.diff', 'data_roastings.id')
            ->get();
        return response($data, 200);
    }
}
