app/Http/Controllers/Asset/WorkOrderController.php
public function store($assetId, $workOrderId)
    {
        if ($this->asset->attachWorkOrder($assetId, $workOrderId)) {
            $message = 'Successfully attached work order.';

            return redirect()->route('maintenance.assets.work-orders.index', [$assetId])->withSuccess($message);
        } else {
            $message = 'There was an issue attaching this work order. Please try again.';

            return redirect()->route('maintenance.assets.work-orders.attach.index', [$assetId])->withErrors($message);
        }
    }
public function store($assetId, $workOrderId)
    {
        if ($this->asset->attachWorkOrder($assetId, $workOrderId)) {
            $message = 'Successfully attached work order.';

            return redirect()->route('maintenance.assets.work-orders.index', [$assetId])->withSuccess($message);
        } else {
            $message = 'There was an issue attaching this work order. Please try again.';

            return redirect()->route('maintenance.assets.work-orders.attach.index', [$assetId])->withErrors($message);
        }
    }
Attaches the specified work order to the specified asset.

@param int|string $assetId
@param int|string $workOrderId

@return \Illuminate\Http\RedirectResponse