{"id":290896,"date":"2018-10-16T18:50:02","date_gmt":"2018-10-16T14:50:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=290896"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=290896","title":{"rendered":"\u041c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0432 Yii2 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u043c\u0435\u043d\u044e"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435 \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0435\u043d\u044e, \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0438\u043b\u0438 \u0440\u0443\u0431\u0440\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 Yii2, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b \u0438\u043c\u0435\u043b\u0438 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c. \u0417\u0430\u0434\u0430\u0447\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043d\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u0415\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 (\u043c\u0435\u043d\u044e, \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0438\u0442\u0434.), \u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u044f\u0437\u044b\u043a\u0430\u043c\u0438. \u041f\u0440\u0438\u0447\u0451\u043c \u0440\u0435\u0447\u044c \u0442\u0443\u0442 \u0438\u0434\u0451\u0442 \u043d\u0435 \u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0430 \u043f\u0440\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0437\u0435 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445. \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u0432\u0438\u0434\u0436\u0435\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433 \u0431\u044b \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u043d\u043e\u0433\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c \u0431\u0435\u0437 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0441 \u043a\u043e\u0434\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u042f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u043c\u0435\u043d\u044e. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Yii2 App Basic, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u043f\u043e\u0434 \u0441\u0432\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d, \u0435\u0441\u043b\u0438 \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/paulzi\/yii2-adjacency-list\" title=\"Yii2  Adjacency List\">Adjacency List<\/a> \u2014 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <br \/>  \u043c\u0435\u043d\u044e \u0432 \u0411\u0414;<\/li>\n<li><a href=\"https:\/\/github.com\/execut\/yii2-widget-bootstraptreeview\" title=\"Bootstrap Treeview widget for Yii2\">Yii2 Bootstrap Treeview<\/a> \u2014 \u0432\u0438\u0434\u0436\u0435\u0442 <br \/>  \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044e \u0432 \u0432\u0438\u0434\u0435 \u0434\u0435\u0440\u0435\u0432\u0430;<\/li>\n<li><a href=\"https:\/\/github.com\/creocoder\/yii2-translateable\" title=\"Yii2 Translateable Behavior\">Translateable Behavior<\/a> \u2014 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0434\u043b\u044f <br \/>  \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 \u043c\u043e\u0434\u0435\u043b\u044f\u0445;<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 composer:<\/p>\n<p>  <\/p>\n<pre><code>composer require paulzi\/yii2-adjacency-list composer require execut\/yii2-widget-bootstraptreeview composer require creocoder\/yii2-translateable<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u0435\u043d\u044e \u0432 \u0432\u0438\u0434\u0435 \u043c\u043e\u0434\u0443\u043b\u044f, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Gii \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 (\u043b\u0438\u0431\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e) \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c menu \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0435\u0433\u043e \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u044f\u0437\u044b\u043a\u043e\u0432. \u042f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0442 \u044d\u0442\u043e <a href=\"https:\/\/github.com\/codemix\/yii2-localeurls\" title=\"Codemix Yii2-localeurls\">\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f Yii2<\/a>.<\/p>\n<p>  <\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0435\u0439<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044e (\u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u043c\u0435\u0435\u0442 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c) \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0432\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <a href=\"https:\/\/habr.com\/post\/192228\/\" title=\"\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u0438 \u0432 \u0432\u0435\u0431-\u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u2014 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438\">\u0440\u0430\u0437\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u0438\u043a\u0438<\/a>, \u043d\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u0434\u0432\u0443\u043c\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430\u043c\u0438, \u043e\u0434\u043d\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u0430\u043c\u0443 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c, \u0430 \u0432\u0442\u043e\u0440\u0430\u044f \u2014 \u0435\u0451 \u044f\u0437\u044b\u043a\u043e\u0432\u044b\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438, \u043c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446 \u0443\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0439 \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">m180819_083502_menu_init.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  use yii\\db\\Schema; use yii\\db\\Migration;  class m180819_083502_menu_init extends Migration {      public function init()     {         $this-&gt;db = 'db';         parent::init();     }      public function safeUp()     {         $tableOptions = 'ENGINE=InnoDB';         $this-&gt;createTable('{{%menu}}', [             'id'=&gt; $this-&gt;primaryKey(11),             'parent_id'=&gt; $this-&gt;integer(11)-&gt;null()-&gt;defaultValue(null),             'link'=&gt; $this-&gt;string(255)-&gt;notNull()-&gt;defaultValue('#'),             'link_attributes'=&gt; $this-&gt;text()-&gt;notNull(),             'icon_class'=&gt; $this-&gt;string(255)-&gt;notNull(),             'sort'=&gt; $this-&gt;integer(11)-&gt;notNull()-&gt;defaultValue(0),             'status'=&gt; $this-&gt;tinyInteger(1)-&gt;notNull()-&gt;defaultValue(1),         ], $tableOptions);         $this-&gt;createIndex('parent_sort', '{{%menu}}', ['parent_id','sort'], false);         $this-&gt;createTable('{{%menu_lang}}', [             'owner_id'=&gt; $this-&gt;integer(11)-&gt;notNull(),             'language'=&gt; $this-&gt;string(2)-&gt;notNull(),             'name'=&gt; $this-&gt;string(255)-&gt;notNull(),             'title'=&gt; $this-&gt;text()-&gt;notNull(),         ], $tableOptions);         $this-&gt;addPrimaryKey('pk_on_menu_lang', '{{%menu_lang}}', ['owner_id','language']);         $this-&gt;addForeignKey(             'fk_menu_lang_owner_id',             '{{%menu_lang}}',             'owner_id',             '{{%menu}}',             'id',             'CASCADE',             'CASCADE'         );         \/\/ Insert sample data         $this-&gt;batchInsert(             '{{%menu}}',             ['id', 'parent_id', 'link', 'link_attributes', 'icon_class', 'sort', 'status'],             [                 [                     'id' =&gt; '1',                     'parent_id' =&gt; null,                     'link' =&gt; '#',                     'link_attributes' =&gt; '',                     'icon_class' =&gt; '',                     'sort' =&gt; '0',                     'status' =&gt; '0',                 ],                 [                     'id' =&gt; '2',                     'parent_id' =&gt; '1',                     'link' =&gt; '\/',                     'link_attributes' =&gt; '',                     'icon_class' =&gt; 'fa fa-home',                     'sort' =&gt; '0',                     'status' =&gt; '1',                 ],             ]         );         $this-&gt;batchInsert(             '{{%menu_lang}}',             ['owner_id', 'language', 'name', 'title'],             [                 [                     'owner_id' =&gt; '1',                     'language' =&gt; 'ru',                     'name' =&gt; '\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u043c\u0435\u043d\u044e',                     'title' =&gt; '',                 ],                 [                     'owner_id' =&gt; '1',                     'language' =&gt; 'en',                     'name' =&gt; 'Main menu',                     'title' =&gt; '',                 ],                 [                     'owner_id' =&gt; '2',                     'language' =&gt; 'ru',                     'name' =&gt; '\u0413\u043b\u0430\u0432\u043d\u0430\u044f',                     'title' =&gt; '\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u0430\u0439\u0442\u0430',                 ],                 [                     'owner_id' =&gt; '2',                     'language' =&gt; 'en',                     'name' =&gt; 'Home',                     'title' =&gt; 'Site homepage',                 ],             ]         );     }      public function safeDown()     {         $this-&gt;truncateTable('{{%menu}} CASCADE');         $this-&gt;dropForeignKey('fk_menu_lang_owner_id', '{{%menu_lang}}');         $this-&gt;dropTable('{{%menu}}');         $this-&gt;dropPrimaryKey('pk_on_menu_lang', '{{%menu_lang}}');         $this-&gt;dropTable('{{%menu_lang}}');     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438 \u0432 \u043f\u0430\u043f\u043a\u0443 \/migrations \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0438<br \/>  \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <\/p>\n<pre><code>php yii migrate<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432 \u043d\u0438\u0445 \u043d\u043e\u0432\u043e\u0435 \u043c\u0435\u043d\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0438\u0433\u0440\u0430\u0446\u0438\u0438, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u043e\u0434\u0435\u043b\u0438. \u0422\u0430\u043a \u043a\u0430\u043a \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u043c\u043e\u0433\u0443\u0442 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u0435\u043d\u044e, \u043d\u043e \u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044f\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0441\u0430\u0439\u0442\u0430), \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u0438 \u0438 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u0435\u0440\u0435\u0432\u0430, \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0435\u0439\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043c\u044b \u043c\u043e\u0433\u043b\u0438 \u043b\u0435\u0433\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u044f\u0445 \u0431\u0435\u0437 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0432 \u043a\u043e\u0440\u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0430\u043f\u043e\u0447\u043a\u0443 traits (\u0435\u0441\u043b\u0438 \u0435\u0451 \u0442\u0430\u043c \u0435\u0449\u0451 \u043d\u0435\u0442) \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0442\u0443\u0434\u0430 \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">LangTrait.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  namespace app\\traits;  use Yii; use yii\\behaviors\\SluggableBehavior; use creocoder\\translateable\\TranslateableBehavior;  trait LangTrait {     public static function langClass()     {         return self::class . 'Lang';     }      public static function langTableName()     {         return self::tableName() . '_lang';     }      public function langBehaviors($translationAttributes)     {         return [             'translateable' =&gt; [                 'class' =&gt; TranslateableBehavior::class,                 'translationAttributes' =&gt; $translationAttributes,                 'translationRelation' =&gt; 'translations',                 'translationLanguageAttribute' =&gt; 'language',             ],         ];     }      public function transactions()     {         return [             self::SCENARIO_DEFAULT =&gt; self::OP_INSERT | self::OP_UPDATE,         ];     }      public function getLang()     {         return $this-&gt;hasOne(self::langClass(), ['owner_id' =&gt; 'id'])-&gt;where([self::langTableName() . '.language' =&gt; Yii::$app-&gt;language]);     }      public function getTranslations()     {         return $this-&gt;hasMany(self::langClass(), ['owner_id' =&gt; 'id']);     }  }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">TreeTrait.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  namespace app\\traits;  use Yii; use yii\\helpers\\Html; use paulzi\\adjacencyList\\AdjacencyListBehavior;  trait TreeTrait {      private static function getQueryClass()     {         return self::class . 'Query';     }      public function treeBehaviors()     {         return [             'tree' =&gt; [                 'class' =&gt; AdjacencyListBehavior::class,                 'parentAttribute' =&gt; 'parent_id',                 'sortable' =&gt; [                     'step' =&gt; 10,                 ],                 'checkLoop' =&gt; false,                 'parentsJoinLevels' =&gt; 5,                 'childrenJoinLevels' =&gt; 5,             ],         ];     }      public static function find()     {         $queryClass = self::getQueryClass();         return new $queryClass(get_called_class());     }      public static function listTree($node = null, $level = 1, $nameAttribute = 'name', $prefix = '--&gt;')     {         $result = [];         if (!$node) {             $node = self::find()-&gt;roots()-&gt;one()-&gt;populateTree();         }         if ($node-&gt;isRoot()) {             $result[$node['id']] = mb_strtoupper($node[$nameAttribute ?: 'slug']);         }         if ($node['children']) {             foreach ($node['children'] as $child) {                 $result[$child['id']] = str_repeat($prefix, $level) . $child[$nameAttribute];                 $result = $result + self::listTree($child, $level + 1, $nameAttribute);             }         }         return $result;     }      public static function treeViewData($node = null)     {         if ($node === null) {             $node = self::find()-&gt;roots()-&gt;one()-&gt;populateTree();         }         $result = null;         $items = null;         $children = null;         if ($node['children']) {             foreach ($node['children'] as $child) {                 $items[] = self::treeViewData($child);             }             $children = call_user_func_array('array_merge', $items);         }         $result[] = [             'text' =&gt; Html::a($node['lang']['name'] ?: $node['id'], ['update', 'id' =&gt; $node['id']], ['title' =&gt; Yii::t('app', '\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442')]),             'tags' =&gt; [                 Html::a(                     '&lt;i class=&quot;glyphicon glyphicon-arrow-down&quot;&gt;&lt;\/i&gt;',                     ['move-down', 'id' =&gt; $node['id']],                     ['title' =&gt; Yii::t('app', '\u041f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0432\u043d\u0438\u0437')]                 ),                 Html::a(                     '&lt;i class=&quot;glyphicon glyphicon-arrow-up&quot;&gt;&lt;\/i&gt;',                     ['move-up', 'id' =&gt; $node['id']],                     ['title' =&gt; Yii::t('app', '\u041f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u0432\u0432\u0435\u0440\u0445')]                 )             ],             'backColor' =&gt; $node['status'] == 0 ? '#ccc' : '#fff',             'selectable' =&gt; false,             'nodes' =&gt; $children,         ];         return $result;     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043c\u0435\u043d\u044e, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c \u0442\u0440\u0435\u0439\u0442\u044b \u0434\u043b\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u0438. \u041c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \/modules\/menu\/models:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">Menu.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  namespace app\\modules\\menu\\models;  use Yii;  class Menu extends \\yii\\db\\ActiveRecord {     use \\app\\traits\\TreeTrait;     use \\app\\traits\\LangTrait;      const STATUS_ACTIVE = 1;     const STATUS_INACTIVE = 0;      public function behaviors()     {         $behaviors = [];         return array_merge(             $behaviors,             $this-&gt;treeBehaviors(),             $this-&gt;langBehaviors(['name', 'title'])         );     }      public static function tableName()     {         return 'menu';     }      public function rules()     {         return [             [['parent_id', 'sort', 'status'], 'integer'],             [['link', 'icon_class'], 'string', 'max' =&gt; 255],             [['link_attributes'], 'string'],             [['link'], 'default', 'value' =&gt; '#'],             [['link_attributes', 'icon_class'], 'default', 'value' =&gt; ''],             [['parent_id'], 'exist', 'skipOnError' =&gt; true, 'targetClass' =&gt; self::class, 'targetAttribute' =&gt; ['parent_id' =&gt; 'id']],         ];     }      public function attributeLabels()     {         return [             'id' =&gt; Yii::t('app', 'ID'),             'parent_id' =&gt; Yii::t('app', '\u0420\u043e\u0434\u0438\u0442\u0435\u043b\u044c'),             'link' =&gt; Yii::t('app', '\u0421\u0441\u044b\u043b\u043a\u0430'),             'link_attributes' =&gt; Yii::t('app', '\u0410\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0441\u0441\u044b\u043b\u043a\u0438 (JSON \u043c\u0430\u0441\u0441\u0438\u0432)'),             'icon_class' =&gt; Yii::t('app', '\u041a\u043b\u0430\u0441\u0441 \u0438\u043a\u043e\u043d\u043a\u0438'),             'sort' =&gt; Yii::t('app', '\u0421\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430'),             'status' =&gt; Yii::t('app', '\u041e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d'),         ];     }      public static function menuItems($node = null)     {         if ($node === null) {             $node = self::find()-&gt;roots()-&gt;one()-&gt;populateTree();         }         $result = null;         $items = null;         $children = null;         if ($node['children']) {             foreach ($node['children'] as $child) {                 $items[] = self::menuItems($child);             }             $children = call_user_func_array('array_merge', $items);         }         $result[] = [             'label' =&gt; ($node['icon_class'] ? '&lt;i class=&quot;' . $node['icon_class'] . '&quot;&gt;&lt;\/i&gt; ' . ($node['lang']['name'] ?: $node['id']) : ($node['lang']['name'] ?: $node['id'] )),             'encode' =&gt; ($node['icon_class'] ? false : true),             'url' =&gt; [$node['link'], 'language' =&gt; Yii::$app-&gt;language],             'active' =&gt; $node['link'] == Yii::$app-&gt;request-&gt;url ? true : false,             'linkOptions' =&gt; ($node['link_attributes'] ? array_merge(json_decode($node['link_attributes'], true), ['title' =&gt; ($node['lang']['title'] ?: $node['lang']['name'])]) : ['title' =&gt; ($node['lang']['title'] ?: $node['lang']['name'])]),             'items' =&gt; $children,         ];         return $result;     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">MenuLang.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  namespace app\\modules\\menu\\models;  use Yii;  class MenuLang extends \\yii\\db\\ActiveRecord {     public static function tableName()     {         return 'menu_lang';     }      public function rules()     {         return [             [['name'], 'required'],             [['name', 'title'], 'string', 'max' =&gt; 255],         ];     }      public function attributeLabels()     {         return [             'owner_id' =&gt; Yii::t('app', '\u0412\u043b\u0430\u0434\u0435\u043b\u0435\u0446'),             'language' =&gt; Yii::t('app', '\u042f\u0437\u044b\u043a'),             'name' =&gt; Yii::t('app', '\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435'),             'title' =&gt; Yii::t('app', '\u0412\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430'),         ];     }      public function getOwner()     {         return $this-&gt;hasOne(Menu::class, ['id' =&gt; 'owner_id']);     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">MenuQuery.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  namespace app\\modules\\menu\\models;  use paulzi\\adjacencyList\\AdjacencyListQueryTrait;  class MenuQuery extends \\yii\\db\\ActiveQuery {     use AdjacencyListQueryTrait; }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">MenuSearch.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  namespace app\\modules\\menu\\models;  use Yii; use yii\\base\\Model; use yii\\data\\ActiveDataProvider; use app\\modules\\menu\\models\\Menu;  class MenuSearch extends Menu {     public $name;      public function rules()     {         return [             [['id', 'parent_id', 'sort', 'status'], 'integer'],             [['link', 'link_attributes', 'icon_class'], 'safe'],             [['name'], 'safe'],         ];     }      public function scenarios()     {         return Model::scenarios();     }      public function search($params)     {         $query = parent::find()-&gt;joinWith(['lang']);         $dataProvider = new ActiveDataProvider([             'query' =&gt; $query,             'sort' =&gt; ['defaultOrder' =&gt; ['sort' =&gt; SORT_ASC]]         ]);         $dataProvider-&gt;sort-&gt;attributes['name'] = [             'asc' =&gt; [                 'menu_lang.name' =&gt; SORT_ASC,             ],             'desc' =&gt; [                 'menu_lang.name' =&gt; SORT_DESC,             ],         ];         $this-&gt;load($params);         if (!$this-&gt;validate()) {             return $dataProvider;         }         $query-&gt;andFilterWhere([             'id' =&gt; $this-&gt;id,             'parent_id' =&gt; $this-&gt;parent_id,             'sort' =&gt; $this-&gt;sort,             'status' =&gt; $this-&gt;status,         ]);         $query-&gt;andFilterWhere(['like', 'link', $this-&gt;link]);         $query-&gt;andFilterWhere(['like', 'link_attributes', $this-&gt;link_attributes]);         $query-&gt;andFilterWhere(['like', 'icon_class', $this-&gt;icon_class]);         $query-&gt;andFilterWhere(['like', 'name', $this-&gt;name]);         return $dataProvider;     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u0435\u043d\u0438\u044f CRUD \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u044b\u043c\u0438 \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440. \u0427\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0436\u0438\u0437\u043d\u044c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c, \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0434\u0438\u043d \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0431\u0443\u0434\u0443\u0442 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0431\u0443\u0434\u044c \u0442\u043e \u043c\u0435\u043d\u044e, \u0438\u043b\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0438\u043b\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u2014 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0435\u0433\u043e.<\/p>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0431\u0430\u0437\u043e\u0432\u044b\u0435, \u043c\u044b \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0435 \/base. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \/base\/controllers\/AdminLangTreeController.php. \u042d\u0442\u043e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u043c \u0434\u043b\u044f CRUD \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">AdminLangTreeController.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  namespace app\\base\\controllers;  use Yii; use yii\\web\\Controller; use yii\\web\\NotFoundHttpException; use yii\\filters\\VerbFilter; use yii\\helpers\\Url;  class AdminLangTreeController extends Controller {     public $modelClass;     public $modelClassSearch;     public $modelName;     public $modelNameLang;      public function behaviors()     {         return [             'verbs' =&gt; [                 'class' =&gt; VerbFilter::class,                 'actions' =&gt; [                     'delete' =&gt; ['POST'],                 ],             ],         ];     }      public function actionIndex()     {         \/\/ \u0415\u0441\u043b\u0438 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0434\u0435\u0440\u0435\u0432\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438         if (count($this-&gt;modelClass::find()-&gt;roots()-&gt;all()) == 0) {             $model = new $this-&gt;modelClass;             $model-&gt;makeRoot()-&gt;save();             Yii::$app-&gt;session-&gt;setFlash('info', Yii::t('app', '\u041a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438'));             return $this-&gt;redirect(['index']);         }         $searchModel = new $this-&gt;modelClassSearch;         $dataProvider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;queryParams);         $dataProvider-&gt;pagination = false;         return $this-&gt;render('index', [             'searchModel' =&gt; $searchModel,             'dataProvider' =&gt; $dataProvider,         ]);     }      public function actionCreate()     {         \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430         if (count($this-&gt;modelClass::find()-&gt;roots()-&gt;all()) == 0) {             return $this-&gt;redirect(['index']);         }         \/\/ \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u0435\u0451 \u043a \u0434\u0435\u0440\u0435\u0432\u0443         $model = new $this-&gt;modelClass;         $root = $model::find()-&gt;roots()-&gt;one();         $model-&gt;parent_id = $root-&gt;id;         \/\/ \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438\u0437 \u0444\u043e\u0440\u043c\u044b         if ($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-&gt;validate()) {             $parent = $model::findOne($model-&gt;parent_id);             $model-&gt;appendTo($parent)-&gt;save();             \/\/ \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435                         foreach (Yii::$app-&gt;request-&gt;post($this-&gt;modelNameLang, []) as $language =&gt; $data) {                 foreach ($data as $attribute =&gt; $translation) {                     $model-&gt;translate($language)-&gt;$attribute = $translation;                 }             }             $model-&gt;save();             Yii::$app-&gt;session-&gt;setFlash('success', Yii::t('app', '\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0448\u043b\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e'));             return $this-&gt;redirect(['update', 'id' =&gt; $model-&gt;id]);         } else {             return $this-&gt;render('create', [                 'model' =&gt; $model,             ]);         }     }      public function actionUpdate($id)     {         \/\/ \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c         $model = $this-&gt;modelClass::find()-&gt;with('translations')-&gt;where(['id' =&gt; $id])-&gt;one();         if ($model === null) {             throw new NotFoundHttpException(Yii::t('app', '\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430'));         }         \/\/ \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0444\u043e\u0440\u043c\u044b         if ($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-&gt;save()) {             foreach (Yii::$app-&gt;request-&gt;post($this-&gt;modelNameLang, []) as $language =&gt; $data) {                 foreach ($data as $attribute =&gt; $translation) {                     $model-&gt;translate($language)-&gt;$attribute = $translation;                 }             }             $model-&gt;save();             Yii::$app-&gt;session-&gt;setFlash('success', Yii::t('app', '\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e'));             if (Yii::$app-&gt;request-&gt;post('save') !== null) {                 return $this-&gt;redirect(['index']);             }             return $this-&gt;redirect(['update', 'id' =&gt; $model-&gt;id]);         } else {             return $this-&gt;render('update', [                 'model' =&gt; $model,             ]);         }     }      public function actionDelete($id)     {         $model = $this-&gt;findModel($id);         \/\/ \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0443\u0437\u043b\u0430, \u0435\u0441\u043b\u0438 \u0443 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u043e\u043c\u043a\u0438         if (count($model-&gt;children) &gt; 0) {             Yii::$app-&gt;session-&gt;setFlash('error', Yii::t('app', '\u042d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0451\u043d, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u0447\u0435\u0440\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b'));             return $this-&gt;redirect(['index']);         }         \/\/ \u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430         if ($model-&gt;isRoot()) {             Yii::$app-&gt;session-&gt;setFlash('error', Yii::t('app', '\u041d\u0435\u043b\u044c\u0437\u044f \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442'));             return $this-&gt;redirect(['index']);         }         \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442         if ($model-&gt;delete()) {             Yii::$app-&gt;session-&gt;setFlash('success', Yii::t('app', '\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e'));         }         return $this-&gt;redirect(['index']);     }      public function actionMoveUp($id)     {         $model = $this-&gt;findModel($id);         if ($prev = $model-&gt;getPrev()-&gt;one()) {             $model-&gt;moveBefore($prev)-&gt;save();             $model-&gt;reorder(false);         } else {             Yii::$app-&gt;session-&gt;setFlash('error', Yii::t('app', '\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u0432\u0435\u0440\u0445'));         }         return $this-&gt;redirect(Yii::$app-&gt;request-&gt;referrer);     }      public function actionMoveDown($id)     {         $model = $this-&gt;findModel($id);         if ($next = $model-&gt;getNext()-&gt;one()) {             $model-&gt;moveAfter($next)-&gt;save();             $model-&gt;reorder(false);         } else {             Yii::$app-&gt;session-&gt;setFlash('error', Yii::t('app', '\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0432\u0438\u043d\u0443\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0432\u043d\u0438\u0437'));         }         return $this-&gt;redirect(Yii::$app-&gt;request-&gt;referrer);     }      protected function findModel($id)     {         if (($model = $this-&gt;modelClass::findOne($id)) !== null) {             return $model;         } else {             throw new NotFoundHttpException(Yii::t('app', '\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u0430'));         }     } }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b \/modules\/menu\/controllers\/AdminController.php. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044e, \u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0434\u0435\u0440\u0435\u0432\u043e \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c, \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">AdminController.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  namespace app\\modules\\menu\\controllers;  use app\\base\\controllers\\AdminLangTreeController as BaseController;  class AdminController extends BaseController {     public $modelClass = \\app\\modules\\menu\\models\\Menu::class;     public $modelClassSearch = \\app\\modules\\menu\\models\\MenuSearch::class;     public $modelName = 'Menu';     public $modelNameLang = 'MenuLang'; }<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043a\u043e\u0434 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043b\u0438\u0448\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u0438\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. \u0422\u043e\u0435\u0441\u0442\u044c, \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f CRUD \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 (\u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430, \u0440\u0443\u0431\u0440\u0438\u043a\u0430\u0442\u043e\u0440\u0430 \u0438\u0442\u0434.), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0440\u0435\u0432\u043e \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u2014 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440.<\/p>\n<p>  <\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044e<\/h2>\n<p>  <\/p>\n<p>\u0417\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f \u2014 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u043e\u043c. \u0421 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u0430 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 Bootstrap Treeview, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0433\u0438\u0431\u043a\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438 \u043e\u043d\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u0434\u0435\u0440\u0435\u0432\u0443). \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 view \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u0430\u043c\u043e\u0433\u043e \u0434\u0435\u0440\u0435\u0432\u0430, \u0438 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u043c \u0435\u0433\u043e \u0432 \/modules\/menu\/views\/admin\/index.php:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">index.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  use yii\\helpers\\Html; use yii\\grid\\GridView; use yii\\widgets\\ActiveForm; use execut\\widget\\TreeView;  $this-&gt;title = Yii::t('app', '\u041c\u0435\u043d\u044e \u0441\u0430\u0439\u0442\u0430'); $this-&gt;params['breadcrumbs'][] = $this-&gt;title; ?&gt; &lt;div class=&quot;row&quot;&gt;     &lt;div class=&quot;col-md-6&quot;&gt;         &lt;div class=&quot;panel panel-primary&quot;&gt;             &lt;div class=&quot;panel-heading&quot;&gt;                 &lt;?= Html::a(Yii::t('app', '\u0421\u043e\u0437\u0434\u0430\u0442\u044c'), ['create'], ['class' =&gt; 'btn btn-success btn-flat']) ?&gt;             &lt;\/div&gt;             &lt;div class=&quot;panel-body&quot;&gt;                 &lt;?= TreeView::widget([                     'id' =&gt; 'tree',                     'data' =&gt; $searchModel::treeViewData($searchModel::find()-&gt;roots()-&gt;one()),                     'header' =&gt; Yii::t('app', '\u041c\u0435\u043d\u044e \u0441\u0430\u0439\u0442\u0430'),                     'searchOptions' =&gt; [                         'inputOptions' =&gt; [                             'placeholder' =&gt; Yii::t('app', '\u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0434\u0435\u0440\u0435\u0432\u0443') . '...'                         ],                     ],                     'clientOptions' =&gt; [                         'selectedBackColor' =&gt; 'rgb(40, 153, 57)',                         'borderColor' =&gt; '#fff',                         'levels' =&gt; 10,                         'showTags' =&gt; true,                         'tagsClass' =&gt; 'badge',                         'enableLinks' =&gt; true,                     ],                 ]) ?&gt;             &lt;\/div&gt;         &lt;\/div&gt;     &lt;\/div&gt; &lt;\/div&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u043c\u044b \u0434\u043e\u0448\u043b\u0438 \u0434\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043a\u0435\u0439\u0441\u0430: \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f\/\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0432 \u043f\u0430\u043f\u043a\u0435 \/modules\/menu\/views\/admin \u0442\u0440\u0438 \u0444\u0430\u0439\u043b\u0430:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">create.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  use yii\\helpers\\Html;  $this-&gt;title = Yii::t('app', '\u0421\u043e\u0437\u0434\u0430\u0442\u044c'); $this-&gt;params['breadcrumbs'][] = ['label' =&gt; Yii::t('app', '\u041c\u0435\u043d\u044e \u0441\u0430\u0439\u0442\u0430'), 'url' =&gt; ['index']]; $this-&gt;params['breadcrumbs'][] = $this-&gt;title;  echo $this-&gt;render('_form', [     'model' =&gt; $model, ]);<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">update.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  use yii\\helpers\\Html;  $this-&gt;title = Yii::t('app', '\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c') . ': ' . $model-&gt;name; $this-&gt;params['breadcrumbs'][] = ['label' =&gt; Yii::t('app', '\u041c\u0435\u043d\u044e \u0441\u0430\u0439\u0442\u0430'), 'url' =&gt; ['index']]; $this-&gt;params['breadcrumbs'][] = ['label' =&gt; $model-&gt;name, 'url' =&gt; ['update', 'id' =&gt; $model-&gt;id]]; $this-&gt;params['breadcrumbs'][] = Yii::t('app', '\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c');  echo $this-&gt;render('_form', [     'model' =&gt; $model, ]);<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">_form.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>&lt;?php  use yii\\helpers\\Html; use yii\\widgets\\ActiveForm;  if ($model-&gt;isNewRecord) {     $model-&gt;status = true; } ?&gt; &lt;div class=&quot;panel panel-primary&quot;&gt;     &lt;?php $form = ActiveForm::begin(); ?&gt;     &lt;div class=&quot;panel-body&quot;&gt;         &lt;fieldset&gt;             &lt;legend&gt;&lt;?= Yii::t('app', '\u041e\u0431\u0449\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438') ?&gt;&lt;\/legend&gt;             &lt;div class=&quot;row&quot;&gt;                 &lt;div class=&quot;col-md-4&quot;&gt;                     &lt;?php if (!$model-&gt;isRoot()) { ?&gt;                         &lt;?= $form-&gt;field($model, 'parent_id')-&gt;dropDownList($model::listTree()) ?&gt;                                         &lt;?php } ?&gt;                     &lt;?= $form-&gt;field($model, 'link')-&gt;textInput(['maxlength' =&gt; true]) ?&gt;                     &lt;?= $form-&gt;field($model, 'link_attributes')-&gt;textInput(['maxlength' =&gt; true]) ?&gt;                     &lt;?= $form-&gt;field($model, 'icon_class')-&gt;textInput(['maxlength' =&gt; true]) ?&gt;                     &lt;?= $form-&gt;field($model, 'status')-&gt;checkbox() ?&gt;                 &lt;\/div&gt;             &lt;\/div&gt;         &lt;\/fieldset&gt;         &lt;fieldset&gt;             &lt;legend&gt;&lt;?= Yii::t('app', '\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435') ?&gt;&lt;\/legend&gt;                 &lt;!-- Nav tabs --&gt;             &lt;ul class=&quot;nav nav-tabs&quot; role=&quot;tablist&quot;&gt;                 &lt;?php foreach (Yii::$app-&gt;urlManager-&gt;languages as $key =&gt; $language) { ?&gt;                     &lt;li role=&quot;presentation&quot; &lt;?= $key == 0 ? 'class=&quot;active&quot;' : '' ?&gt;&gt;                         &lt;a href=&quot;#tab-content-&lt;?= $language ?&gt;&quot; aria-controls=&quot;tab-content-&lt;?= $language ?&gt;&quot; role=&quot;tab&quot; data-toggle=&quot;tab&quot;&gt;&lt;?= $language ?&gt;&lt;\/a&gt;                     &lt;\/li&gt;                 &lt;?php } ?&gt;             &lt;\/ul&gt;             &lt;!-- Tab panes --&gt;             &lt;div class=&quot;tab-content&quot;&gt;                 &lt;?php foreach (Yii::$app-&gt;urlManager-&gt;languages as $key =&gt; $language) { ?&gt;                     &lt;div role=&quot;tabpanel&quot; class=&quot;tab-pane &lt;?= $key == 0 ? 'active' : '' ?&gt;&quot; id=&quot;tab-content-&lt;?= $language ?&gt;&quot;&gt;                         &lt;?= $form-&gt;field($model-&gt;translate($language), &quot;[$language]name&quot;)-&gt;textInput() ?&gt;                         &lt;?= $form-&gt;field($model-&gt;translate($language), &quot;[$language]title&quot;)-&gt;textInput() ?&gt;                     &lt;\/div&gt;                 &lt;?php } ?&gt;             &lt;\/div&gt;         &lt;\/fieldset&gt;             &lt;\/div&gt;     &lt;div class=&quot;box-footer&quot;&gt;         &lt;?= Html::submitButton($model-&gt;isNewRecord ? '&lt;i class=&quot;fa fa-plus&quot;&gt;&lt;\/i&gt; ' . Yii::t('app', '\u0421\u043e\u0437\u0434\u0430\u0442\u044c') : '&lt;i class=&quot;fa fa-refresh&quot;&gt;&lt;\/i&gt; ' . Yii::t('app', '\u041e\u0431\u043d\u043e\u0432\u0438\u0442\u044c'), ['class' =&gt; $model-&gt;isNewRecord ? 'btn btn-primary' : 'btn btn-success']) ?&gt;     &lt;?= !$model-&gt;isNewRecord ? Html::submitButton('&lt;i class=&quot;fa fa-save&quot;&gt;&lt;\/i&gt; ' . Yii::t('app', '\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c'), ['class' =&gt; 'btn btn-warning', 'name' =&gt; 'save']) : ''; ?&gt;     &lt;?= !$model-&gt;isNewRecord ? Html::a('&lt;i class=&quot;fa fa-trash&quot;&gt;&lt;\/i&gt; ' . Yii::t('app', '\u0423\u0434\u0430\u043b\u0438\u0442\u044c'), ['delete', 'id' =&gt; $model-&gt;id], ['class' =&gt; 'btn btn-danger', 'data' =&gt; ['confirm' =&gt; Yii::t('app', '\u0412\u044b \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442?'), 'method' =&gt; 'post']]) : ''; ?&gt;     &lt;\/div&gt;     &lt;?php ActiveForm::end(); ?&gt; &lt;\/div&gt;<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d \u044f\u0437\u044b\u043a \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 language), \u0430 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 UrlManager \u2014 \u043c\u0430\u0441\u0441\u0438\u0432 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u043e\u0432 (languages), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u042f\u0437\u044b\u043a \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c \u0432 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u0435.<\/p>\n<p>  <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0413\u043e\u0442\u043e\u0432\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0433\u043e \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044e \u0441\u0430\u0439\u0442\u0430 \u0441 \u0443\u0434\u043e\u0431\u043d\u044b\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c;<\/li>\n<li>\u0411\u0430\u0437\u043e\u0432\u044b\u0439 CRUD \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u0440\u0435\u0432\u043e \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c;<\/li>\n<li>\u0414\u0432\u0430 \u0442\u0440\u0435\u0439\u0442\u0430 (\u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0434\u0435\u0440\u0435\u0432\u043e), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u043a \u043c\u043e\u0434\u0435\u043b\u044f\u043c \u0434\u043b\u044f \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u042f \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0439 \u0438 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0432\u0430\u043c \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u043e\u0432\u044b\u0445 \u0445\u043e\u0440\u043e\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 Yii2.<\/p>\n<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/426625\/\"> https:\/\/habr.com\/post\/426625\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0435 \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043c\u0435\u043d\u044e, \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0438\u043b\u0438 \u0440\u0443\u0431\u0440\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 Yii2, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b \u0438\u043c\u0435\u043b\u0438 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u044f\u0437\u044b\u0447\u043d\u043e\u0441\u0442\u044c. \u0417\u0430\u0434\u0430\u0447\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u043d\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430. \u0415\u0441\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0433\u043e\u0442\u043e\u0432\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0434\u0440\u0435\u0432\u043e\u0432\u0438\u0434\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 (\u043c\u0435\u043d\u044e, \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432 \u0438\u0442\u0434.), \u043d\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u043b\u043e \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u044f\u0437\u044b\u043a\u0430\u043c\u0438. \u041f\u0440\u0438\u0447\u0451\u043c \u0440\u0435\u0447\u044c \u0442\u0443\u0442 \u0438\u0434\u0451\u0442 \u043d\u0435 \u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0430 \u043f\u0440\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0431\u0430\u0437\u0435 \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u044f\u0437\u044b\u043a\u0430\u0445. \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u0432\u0438\u0434\u0436\u0435\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0435\u0440\u0435\u0432\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0433 \u0431\u044b \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043c\u043d\u043e\u0433\u043e\u044f\u0437\u044b\u0447\u043d\u044b\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c \u0431\u0435\u0437 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0441 \u043a\u043e\u0434\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u042f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u043c \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0434\u0443\u043b\u044f \u043c\u0435\u043d\u044e. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Yii2 App Basic, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u043f\u043e\u0434 \u0441\u0432\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d, \u0435\u0441\u043b\u0438 \u043e\u043d \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-290896","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=290896"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/290896\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=290896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=290896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=290896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}