при get все работает, но при post выдает такою ошибку:
Method Not Allowed
Method Not Allowed. This url can only handle the following request methods: POST.
0
405
yii\web\MethodNotAllowedHttpException
вот сам код:
<?
namespace app\controllers;
use yii\rest\ActiveController;
class PostsController extends ActiveController
{
public $modelClass = 'app\models\Posts';
}
['class' => 'yii\rest\UrlRule',
'controller' => 'usersrest',
'tokens' => [
'{id}' => ''
],
'pluralize'=>false
],
<?php
namespace app\models;
use yii\db\ActiveRecord;
/**
* LoginForm is the model behind the login form.
*
* @property User|null $user This property is read-only.
*
*/
class Posts extends ActiveRecord
{
public static function tableName()
{
return 'posts';
}
public static function primaryKey()
{
return ['id'];
}
/**
* Define rules for validation
*/
public function rules()
{
return [
[['title', 'descripton'], 'required']
];
}
}
как решить данную проблему?