7df05890
Alexey Boroda
-Requests backend...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<?php
namespace backend\controllers;
use artbox\core\admin\interfaces\ControllerInterface;
use backend\actions\Index;
use common\models\Customer;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
class RequestController extends Controller implements ControllerInterface
{
public function actions()
{
return [
'index' => [
'class' => Index::class,
'columns' => [
|
c3804352
alex
4) в админке подп...
|
19
20
21
22
23
|
'id' => [
'type' => Index::NUMBER_COL,
],
'name' => [
|
b32c8ed8
Alexey Boroda
-Testing email
|
24
|
'type' => Index::ACTION_COL,
|
7df05890
Alexey Boroda
-Requests backend...
|
25
|
'columnConfig' => [
|
d74c8480
alex
remove {delete} ...
|
26
27
|
#'buttonsTemplate' => '{edit}{delete}',
'buttonsTemplate' => '{edit}',
|
b32c8ed8
Alexey Boroda
-Testing email
|
28
|
],
|
7df05890
Alexey Boroda
-Requests backend...
|
29
|
],
|
c3804352
alex
4) в админке подп...
|
30
|
|
7df05890
Alexey Boroda
-Requests backend...
|
31
32
33
34
35
36
37
38
39
|
'organization' => [
'type' => Index::STRING_COL,
],
],
'model' => Customer::class,
'hasLanguage' => false,
'enableMassDelete' => true,
'modelPrimaryKey' => 'id',
'create' => false,
|
c3804352
alex
4) в админке подп...
|
40
|
'defaultSort' => ['id' => SORT_DESC]
|
7df05890
Alexey Boroda
-Requests backend...
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
],
];
}
public function actionUpdate($id)
{
$model = $this->findModel($id);
return $this->render(
'update',
[
'model' => $model,
]
);
}
/**
* @param $id
*
* @return \common\models\Customer|mixed|null
* @throws \yii\web\NotFoundHttpException
*/
public function findModel($id)
{
$model = Customer::findOne($id);
if ($model) {
return $model;
} else {
throw new NotFoundHttpException();
}
}
/**
* Create new model
*
* @return mixed
*/
public function newModel()
{
return new Customer();
}
/**
* @param $id
*
* @return bool|mixed
* @throws \Throwable
* @throws \yii\db\StaleObjectException
* @throws \yii\web\NotFoundHttpException
*/
public function deleteModel($id)
{
$model = $this->findModel($id);
if ($model->delete()) {
return true;
} else {
return false;
}
}
}
|