Change the Order Status

@param \AvoRed\Framework\Models\Database\Order $order
@return \Illuminate\Http\RedirectResponse
196426
public function updateStatus(Model $order, UpdateOrderStatusRequest $request)
    {
        //$order = Model::find($id);
        $order->update($request->all());

        $userEmail = $order->user->email;
        $orderStatusTitle = $order->orderStatus->name;

        $orderHistoryRepository = app(OrderHistoryInterface::class);
        $orderHistoryRepository->create(['order_id' => $order->id, 'order_status_id' => $request->get('order_status_id')]);

        Mail::to($userEmail)->send(new UpdateOrderStatusMail($orderStatusTitle));

        return redirect()->route('admin.order.index');
    }
1173982
public static function updateOrderStatus($orderId, $status, $comments) {
        $body = array("status" => $status, "comments" => $comments);
        $response = self::requestApi("put", $body, $orderId);
        return $response->isOk();
    }
213699
public function rateAction(Order $order, $rating)
    {
        $order->rate($rating);

        $em = $this->getDoctrine()->getEntityManager();
        $em->persist($order);
        $em->flush();

        return $this->redirect($this->generateUrl('Order_show', array(
            'id' => $order->getNumberForPath()
        )));
    }
90252
public function setOrder($order)
    {
        if (!in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
            throw new LogicException('Invalid order argument.');
        }

        $this->order = $order;

        return $this;
    }
1148044
public final function setOrderData(Order $order)
    {
        if (get_called_class() != self::class) {
            throw new \InvalidArgumentException("Method can be call only by OrderFinalized entity");
        }
        $this->id = $order->id;
        $this->setProperties($order);
    }
982623
public function statusReturn($order)
	{
		$payReturn = PayReturn::find($order->idLastReturn);
		if (!$payReturn) {
			return $this->resultMessage('Нет такого возврата');
		}

		$gate = new Gateway($this->makeCurl());
		$isSuccess = $gate->doRequestReturnStatus($payReturn->order_id, $payReturn->id);
		if (!$isSuccess) {
			return $this->resultMessage($gate->getError());
		}
		$newReturnStatus = $payReturn->changeStatus($gate->getValuePayReturnStatus());

		$message = 'Текущий статус возврата - '
			. Dictionary::statusRussian($newReturnStatus);

		return $this->resultMessage($message, 'Сообщение');

	}
480074
private function setOrder($order)
    {
        if (!\in_array($order, [self::ORDER_ASC, self::ORDER_DESC])) {
            throw new \InvalidArgumentException('Invalid order: ' . $order);
        }

        $this->order = $order;

        return $this;
    }
487158
public function order($order, $type = 'DESC')
    {

        $this->string['order'] .= $this->useBuilder('order')
            ->order($order, $type);

        return $this;
    }
495384
public function sortable($order = null)
    {
        if (null === $order) {
            return $this->sortable;
        }

        $this->sortable = $order;
        return $this;
    }
320577
public function setOrder(string $order, string $direction): self
    {
        return $this->setParam('order', [$order => $direction]);
    }
1264163
public function setSortOrder($order = true)
    {
        $this->order = (bool) $order;

        // jeśli podano jako string
        $order = trim(strtolower($order));
        ($order === 'asc') and ($this->order = true);
        ($order === 'desc') and ($this->order = false);

        return $this;
    }
299722
public function update(OrderStatusRequest $request, OrderStatus $orderStatus)
    {
        if ($request->is_default == 1) {
            $this->_setIsDefault();
        }
        $orderStatus->update($request->all());

        return redirect()->route('admin.order-status.index');
    }
1330792
public function update($order)
    {
        $orderId = "";

        if (is_array($order)) {
            $orderId = $order["id"];
        }
        elseif (is_object($order)) {
            $orderId = $order->id;
        }

        return $this->client->put("/orders/" . rawurlencode($orderId), $order, null);
    }
543538
public function receiveAction(Order $order)
    {
        $order->receiveByHub();

        $em = $this->getDoctrine()->getEntityManager();
        $em->persist($order);
        $em->flush();

        return $this->redirect($this->generateUrl('Order_show', array(
            'id' => $order->getNumberForPath()
        )));
    }
480293
protected function setOrder(Select $query, array $order)
    {
        // Normalize to [['column', 'direction']] format if only one column
        if (! is_array(Arr::get($order, 0))) {
            $order = [$order];
        }

        foreach ($order as $key => $orderValue) {
            if (is_array($orderValue)) {
                // Column and direction
                $query->order(
                    Arr::get($orderValue, 0).' '.Arr::get($orderValue, 1)
                );
            }
        }

        return $query;
    }
1114219
public function orderBy($sort, $order = 'ASC') {
        if ($order == 'ASC' || $order == 'DESC') {
            $this->q->apd(' ORDER BY ' . $sort . ' ' .$order);
        } else {
            $this->setError('q', 'No valid order');
            return false;
        }

        return $this;
    }
969159
public function setOrderStatus(StatusInterface $orderStatus)
    {
        $this->orderStatusCode = $orderStatus->getCode();
        $this->orderStatusLabel = $orderStatus->getLabel();
    }