/** * @SWG\Property(name="comment", type="string", required=false) */ public function get() { $ordersStatusModel = $this->_model->status()->first(); $ordersStatusView = new ModelViews\OrdersStatus($ordersStatusModel); $items = []; foreach ($this->_model->items()->get() as $ordersItemModel) { $ordersItemView = new ModelViews\OrdersItem($ordersItemModel); $items[] = $ordersItemView->get(); } return ['id' => $this->_model->id, 'orders_status' => $ordersStatusView->get(), 'items' => $items, 'total' => $this->_model->total, 'comment' => $this->_model->comment]; }
/** * @SWG\Api( * path="/orders_status/all", * @SWG\Operation( * nickname="Get all orders status", * method="GET", * summary="Find all orders status", * notes="Returns all orders status", * type="array", * @SWG\Items("OrdersStatus"), * authorizations={} * ) * ) */ public function all() { $statusCode = 200; $response = []; $ordersStatusModels = Models\OrdersStatus::all(); foreach ($ordersStatusModels as $ordersStatusModel) { $ordersStatusView = new ModelViews\OrdersStatus($ordersStatusModel); $response[] = $ordersStatusView->get(); } return \Response::json($response, $statusCode); }