app/Http/Presenters/WorkOrder/WorkOrderPartStockPresenter.php
public function table(WorkOrder $workOrder, Inventory $item)
    {
        $stocks = $item->stocks();

        return $this->table->of('work-orders.parts.stocks', function (TableGrid $table) use ($workOrder, $item, $stocks) {
            $table->with($stocks)->paginate($this->perPage);

            $table->column('location', function (Column $column) use ($item) {
                $column->value = function (InventoryStock $stock) use ($item) {
                    $name = $stock->location->trail;

                    return link_to_route('maintenance.inventory.stocks.show', $name, [$item->getKey(), $stock->getKey()]);
                };
            });

            $table->column('quantity');

            $table->column('select', function (Column $column) use ($workOrder, $item) {
                $column->value = function (InventoryStock $stock) use ($workOrder, $item) {
                    $route = 'maintenance.work-orders.parts.stocks.take';

                    $params = [$workOrder->getKey(), $item->getKey(), $stock->getKey()];

                    $attributes = [
                        'class' => 'btn btn-default btn-sm',
                    ];

                    return link_to_route($route, 'Select', $params, $attributes);
                };
            });
        });
    }
public function table(WorkOrder $workOrder, Inventory $item)
    {
        $stocks = $item->stocks();

        return $this->table->of('work-orders.parts.stocks', function (TableGrid $table) use ($workOrder, $item, $stocks) {
            $table->with($stocks)->paginate($this->perPage);

            $table->column('location', function (Column $column) use ($item) {
                $column->value = function (InventoryStock $stock) use ($item) {
                    $name = $stock->location->trail;

                    return link_to_route('maintenance.inventory.stocks.show', $name, [$item->getKey(), $stock->getKey()]);
                };
            });

            $table->column('quantity');

            $table->column('select', function (Column $column) use ($workOrder, $item) {
                $column->value = function (InventoryStock $stock) use ($workOrder, $item) {
                    $route = 'maintenance.work-orders.parts.stocks.take';

                    $params = [$workOrder->getKey(), $item->getKey(), $stock->getKey()];

                    $attributes = [
                        'class' => 'btn btn-default btn-sm',
                    ];

                    return link_to_route($route, 'Select', $params, $attributes);
                };
            });
        });
    }
Returns a new table of stocks for the specified inventory
item for work order part selection.

@param WorkOrder $workOrder
@param Inventory $item

@return \Orchestra\Contracts\Html\Builder