31 lines
757 B
PHP
31 lines
757 B
PHP
|
<?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();
|
||
|
}
|
||
|
}
|