app/Http/Controllers/WorkOrder/AssignmentController.php
public function store($workOrder_id)
    {
        if ($this->assignmentValidator->passes()) {
            $workOrder = $this->workOrder->find($workOrder_id);

            $data = $this->inputAll();
            $data['work_order_id'] = $workOrder->id;

            $records = $this->assignment->setInput($data)->create();

            if ($records) {
                $this->message = 'Successfully assigned worker(s)';
                $this->messageType = 'success';
                $this->redirect = route('maintenance.work-orders.show', [$workOrder->id]);
            } else {
                $this->message = 'There was an error trying to assign workers to this work order. Please try again.';
                $this->messageType = 'danger';
                $this->redirect = route('maintenance.work-orders.show', [$workOrder->id]);
            }
        } else {
            $this->errors = $this->assignmentValidator->getErrors();
            $this->redirect = route('maintenance.work-orders.show', [$workOrder_id]);
        }

        return $this->response();
    }
public function store($workOrder_id)
    {
        if ($this->assignmentValidator->passes()) {
            $workOrder = $this->workOrder->find($workOrder_id);

            $data = $this->inputAll();
            $data['work_order_id'] = $workOrder->id;

            $records = $this->assignment->setInput($data)->create();

            if ($records) {
                $this->message = 'Successfully assigned worker(s)';
                $this->messageType = 'success';
                $this->redirect = route('maintenance.work-orders.show', [$workOrder->id]);
            } else {
                $this->message = 'There was an error trying to assign workers to this work order. Please try again.';
                $this->messageType = 'danger';
                $this->redirect = route('maintenance.work-orders.show', [$workOrder->id]);
            }
        } else {
            $this->errors = $this->assignmentValidator->getErrors();
            $this->redirect = route('maintenance.work-orders.show', [$workOrder_id]);
        }

        return $this->response();
    }
Assigns workers to the specified work order ID.

@param string|int $workOrder_id

@return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse