This commit is contained in:
Kavalar 2024-05-26 12:52:52 +03:00
parent df93c25693
commit 6812f2333e
5 changed files with 116 additions and 67 deletions

View File

@ -24,18 +24,30 @@ class AddressesController extends Controller
} }
/** /**
* {@inheritdoc} * @inheritDoc
*/ */
public function behaviors() public function behaviors()
{ {
return [ return array_merge(
'verbs' => [ parent::behaviors(),
'class' => VerbFilter::className(), [
'actions' => [ 'verbs' => [
'delete' => ['POST'], 'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
], ],
], 'access' => [
]; 'class' => \yii\filters\AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
],
],
],
]
);
} }
/** /**

View File

@ -14,19 +14,32 @@ use yii\filters\VerbFilter;
*/ */
class CheckController extends Controller class CheckController extends Controller
{ {
/** /**
* {@inheritdoc} * @inheritDoc
*/ */
public function behaviors() public function behaviors()
{ {
return [ return array_merge(
'verbs' => [ parent::behaviors(),
'class' => VerbFilter::className(), [
'actions' => [ 'verbs' => [
'delete' => ['POST'], 'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
], ],
], 'access' => [
]; 'class' => \yii\filters\AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
],
],
],
]
);
} }
/** /**

View File

@ -26,44 +26,44 @@ class CompanyController extends Controller
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function behaviors() // public function behaviors()
{ // {
return [ // return [
'verbs' => [ // 'verbs' => [
'class' => VerbFilter::className(), // 'class' => VerbFilter::className(),
'actions' => [ // 'actions' => [
'delete' => ['POST'], // 'delete' => ['POST'],
], // ],
], // ],
]; // ];
} // }
/** /**
* @inheritDoc * @inheritDoc
*/ */
// public function behaviors() public function behaviors()
// { {
// return array_merge( return array_merge(
// parent::behaviors(), parent::behaviors(),
// [ [
// 'verbs' => [ 'verbs' => [
// 'class' => VerbFilter::className(), 'class' => VerbFilter::className(),
// 'actions' => [ 'actions' => [
// 'delete' => ['POST'], 'delete' => ['POST'],
// ], ],
// ], ],
// 'access' => [ 'access' => [
// 'class' => \yii\filters\AccessControl::className(), 'class' => \yii\filters\AccessControl::className(),
// 'rules' => [ 'rules' => [
// [ [
// 'allow' => true, 'allow' => true,
// 'roles' => ['@'], 'roles' => ['@'],
// ], ],
// ], ],
// ], ],
// ] ]
// ); );
// } }
/** /**
* Lists all Company models. * Lists all Company models.
@ -108,7 +108,7 @@ class CompanyController extends Controller
if ($model->load($this->request->post()) && $model->save()) { if ($model->load($this->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id]); return $this->redirect(['view', 'id' => $model->id]);
} }
Debug::prn($model); Debug::prn($model->errors);
} else { } else {
$model->loadDefaultValues(); $model->loadDefaultValues();
} }

View File

@ -24,18 +24,30 @@ class ProductController extends Controller
} }
/** /**
* {@inheritdoc} * @inheritDoc
*/ */
public function behaviors() public function behaviors()
{ {
return [ return array_merge(
'verbs' => [ parent::behaviors(),
'class' => VerbFilter::className(), [
'actions' => [ 'verbs' => [
'delete' => ['POST'], 'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
], ],
], 'access' => [
]; 'class' => \yii\filters\AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
],
],
],
]
);
} }
/** /**

View File

@ -27,18 +27,30 @@ class ProductCategoryController extends Controller
} }
/** /**
* {@inheritdoc} * @inheritDoc
*/ */
public function behaviors() public function behaviors()
{ {
return [ return array_merge(
'verbs' => [ parent::behaviors(),
'class' => VerbFilter::className(), [
'actions' => [ 'verbs' => [
'delete' => ['POST'], 'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
], ],
], 'access' => [
]; 'class' => \yii\filters\AccessControl::className(),
'rules' => [
[
'allow' => true,
'roles' => ['@'],
],
],
],
]
);
} }
/** /**