first commit
This commit is contained in:
30
frontend/controllers/OrderController.php
Executable file
30
frontend/controllers/OrderController.php
Executable file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\controllers;
|
||||
|
||||
|
||||
use common\models\Order;
|
||||
|
||||
/**
|
||||
* Product controller
|
||||
*/
|
||||
class OrderController extends BaseApiController
|
||||
{
|
||||
public function actionGetAll()
|
||||
{
|
||||
return Order::find()
|
||||
->where(['user_id' => \Yii::$app->user->id])
|
||||
->select(['id', 'strength', 'amount', 'table_id'])
|
||||
->orderBy(['created_at' => SORT_DESC])
|
||||
->with([
|
||||
'table' => function (\yii\db\ActiveQuery $query) {
|
||||
$query->select(['id', 'name']);
|
||||
},
|
||||
'products' => function (\yii\db\ActiveQuery $query) {
|
||||
$query->select(['id', 'taste']);
|
||||
},
|
||||
])
|
||||
->asArray()
|
||||
->all();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user