first commit

This commit is contained in:
2023-11-21 19:51:44 +03:00
commit b87eb71ca7
254 changed files with 15630 additions and 0 deletions

View File

@ -0,0 +1,28 @@
<?php
namespace frontend\controllers;
use common\models\Product;
/**
* Product controller
*/
class ProductController extends BaseApiController
{
public function actionGetByCategoryId($category_id)
{
return Product::find()
->where(['status' => Product::STATUS_ACTIVE, 'category_id' => $category_id])
->select(['id', 'name', 'description', 'price'])
->all();
}
public function actionGetById($id)
{
return Product::find()
->where(['status' => Product::STATUS_ACTIVE, 'id' => $id])
->select(['id', 'name', 'description', 'price'])
->one();
}
}