Через gii сделал CRUD. В конфиге:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'/' => 'site/index',
'o-centre' => 'site/about',
'contacts' => 'site/contacts',
'VuvZueEd' => 'admin/index',
'VuvZueEd/login' => 'admin/login',
'VuvZueEd/logout' => 'admin/logout',
'VuvZueEd/pages' => 'admin/pages/index',
'VuvZueEd/events' => 'admin/events/index',
'VuvZueEd/journal' => 'admin/journal/index',
'VuvZueEd/services' => 'admin/services/index',
'VuvZueEd/specialists' => 'admin/specialists/index',
'VuvZueEd/services/category' => 'admin/servicescategory/index',
'forms/<action:[\w-]+>' => 'forms/<action>',
[
'pattern'=> 'specialists/<url:[\w-]+>',
'route' => 'specialists/show',
'suffix' => '.html',
],
[
'pattern'=> 'services/<url:[\w-]+>',
'route' => 'services/show',
'suffix' => '.html',
],
[
'pattern'=> 'events/<url:[\w-]+>',
'route' => 'events/show',
'suffix' => '.html',
],
[
'pattern'=> 'journal/<url:[\w-]+>',
'route' => 'journal/show',
'suffix' => '.html',
],
'<controller:[\w-]+>' => '<controller>/index',
],
Структура:Модели:./models:
ServicesCategory.php
ServicesCategorySearch.php
Контроллеры:./controllers/admin:
ServicesCategoryController.php
Вьюхи:./admin/services:
_form.php
_search.php
category/
create.php
index.php
update.php
view.php
./admin/services/category:
_form.php
_search.php
create.php
index.php
update.php
view.php
Перехожу по url /service/category а мне ошибку:
spoilerAn Error occurred while handling another error:
yii\base\InvalidRouteException: Unable to resolve the request: site/error in /Library/WebServer/Documents/psy-zolotoe-sechenie/vendor/yiisoft/yii2/base/Controller.php:127
Stack trace:
#0 /Library/WebServer/Documents/psy-zolotoe-sechenie/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('error', Array)
#1 /Library/WebServer/Documents/psy-zolotoe-sechenie/vendor/yiisoft/yii2/web/ErrorHandler.php(97): yii\base\Module->runAction('site/error')
#2 /Library/WebServer/Documents/psy-zolotoe-sechenie/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\web\NotFoundHttpException))
#3 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\NotFoundHttpException))
#4 {main}
Previous exception:
yii\base\InvalidRouteException: Unable to resolve the request "admin/ServicesCategory/index". in /Library/WebServer/Documents/psy/vendor/yiisoft/yii2/base/Module.php:532
Stack trace:
#0 /Library/WebServer/Documents/psy/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('admin/ServicesC...', Array)
#1 /Library/WebServer/Documents/psy/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
#2 /Library/WebServer/Documents/psy/web/index.php(12): yii\base\Application->run()
#3 {main}
Next yii\web\NotFoundHttpException: Страница не найдена. in /Library/WebServer/Documents/psy-zolotoe-sechenie/vendor/yiisoft/yii2/web/Application.php:114
Stack trace:
#0 /Library/WebServer/Documents/psy-zolotoe-sechenie/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
#1 /Library/WebServer/Documents/psy-zolotoe-sechenie/web/index.php(12): yii\base\Application->run()
#2 {main}