update CRUD list-management

This commit is contained in:
2020-12-04 10:11:56 +07:00
parent efb4113001
commit 6030ccd0a5
11 changed files with 428 additions and 43 deletions

View File

@@ -7,6 +7,7 @@ use yii\web\Controller;
use yii\filters\VerbFilter;
use yii\helpers\FileHelper;
use app\models\CaptureLogs;
use app\models\ListManagement;
/**
* CardController implements the CRUD actions for Card model.
@@ -76,6 +77,25 @@ class ApiController extends Controller {
}
}
public function actionGetAllFeatures() {
$listManagement = ListManagement::find()->all();
$allFeatures = [];
foreach ($listManagement as $key => $value) {
$features = json_decode($value->image, true);
$f = [];
foreach ($features as $k => $v) {
$f[] = $v['features'];
}
$allFeatures[] = [
"id" => $value->id,
"name" => $value->name,
"features" => $f
];
}
Yii::$app->response->format = "json";
return $allFeatures;
}
public function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);