app/Http/Presenters/WorkOrder/WorkOrderPartPresenter.php
public function table(WorkOrder $workOrder)
    {
        $parts = $workOrder->parts();

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

            $table->pageName = 'page-parts';

            $table->column('ID', 'id');

            $table->column('SKU', function (Column $column) {
                $column->value = function (InventoryStock $stock) {
                    return $stock->item->getSku();
                };
            });

            $table->column('name', function (Column $column) {
                $column->value = function (InventoryStock $stock) {
                    return $stock->item->name;
                };
            });

            $table->column('location', function (Column $column) {
                $column->value = function (InventoryStock $stock) {
                    return $stock->location->trail;
                };
            });

            $table->column('taken', function (Column $column) {
                $column->value = function (InventoryStock $stock) {
                    return $stock->quantity;
                };
            });

            $table->column('return', function (Column $column) use ($workOrder) {
                $column->label = 'Return Stock';
                $column->value = function (InventoryStock $stock) use ($workOrder) {
                    $route = 'maintenance.work-orders.parts.stocks.put';

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

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

                    return link_to_route($route, 'Return', $params, $attributes);
                };
            });
        });
    }
public function table(WorkOrder $workOrder)
    {
        $parts = $workOrder->parts();

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

            $table->pageName = 'page-parts';

            $table->column('ID', 'id');

            $table->column('SKU', function (Column $column) {
                $column->value = function (InventoryStock $stock) {
                    return $stock->item->getSku();
                };
            });

            $table->column('name', function (Column $column) {
                $column->value = function (InventoryStock $stock) {
                    return $stock->item->name;
                };
            });

            $table->column('location', function (Column $column) {
                $column->value = function (InventoryStock $stock) {
                    return $stock->location->trail;
                };
            });

            $table->column('taken', function (Column $column) {
                $column->value = function (InventoryStock $stock) {
                    return $stock->quantity;
                };
            });

            $table->column('return', function (Column $column) use ($workOrder) {
                $column->label = 'Return Stock';
                $column->value = function (InventoryStock $stock) use ($workOrder) {
                    $route = 'maintenance.work-orders.parts.stocks.put';

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

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

                    return link_to_route($route, 'Return', $params, $attributes);
                };
            });
        });
    }
Returns a new table of all parts attached to the specified work order.

@param WorkOrder $workOrder

@return \Orchestra\Contracts\Html\Builder