Commit 3dafac9b2ca17713de937504c623c295bdea0cc5
1 parent
58743b31
add routing and create user migration
Showing
4 changed files
with
75 additions
and
18 deletions
Show diff stats
.htaccess
1 | -Mod_Autoindex | |
2 | -<IfModule mod_autoindex.c> | |
3 | - # Запрещаем просмотр содержимого папок | |
4 | - Options -Indexes | |
5 | -</IfModule> | |
6 | - | |
7 | -Mod_Rewrite | |
8 | -<IfModule mod_rewrite.c> | |
9 | - Options +FollowSymlinks | |
10 | - # Включаем mod_rewrite | |
11 | - RewriteEngine On | |
12 | - IndexIgnore */* | |
13 | - # Перенаправляем administrator на входной скрипт админки | |
14 | - RewriteRule ^administrator/(.*)?$ /backend/web/$1 [L,PT] | |
15 | - RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] | |
16 | - # Перенаправляем все запросы на входной скрипт | |
17 | - RewriteRule ^([^/].*)?$ /frontend/web/$1 | |
18 | -</IfModule> | |
19 | 1 | \ No newline at end of file |
2 | +#Mod_Autoindex | |
3 | +#<IfModule mod_autoindex.c> | |
4 | +# # Запрещаем просмотр содержимого папок | |
5 | +# Options -Indexes | |
6 | +#</IfModule> | |
7 | +# | |
8 | +#Mod_Rewrite | |
9 | +#<IfModule mod_rewrite.c> | |
10 | +# Options +FollowSymlinks | |
11 | +# # Включаем mod_rewrite | |
12 | +# RewriteEngine On | |
13 | +# IndexIgnore */* | |
14 | +# # Перенаправляем administrator на входной скрипт админки | |
15 | +# RewriteRule ^administrator/(.*)?$ /backend/web/$1 [L,PT] | |
16 | +# RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] | |
17 | +# # Перенаправляем все запросы на входной скрипт | |
18 | +# RewriteRule ^([^/].*)?$ /frontend/web/$1 | |
19 | +#</IfModule> | |
20 | 20 | \ No newline at end of file | ... | ... |
common/config/main.php
1 | 1 | <?php |
2 | +$rules = require(__DIR__ . '/rules.php'); | |
2 | 3 | return [ |
3 | 4 | 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', |
4 | 5 | 'components' => [ |
5 | 6 | 'cache' => [ |
6 | 7 | 'class' => 'yii\caching\FileCache', |
7 | 8 | ], |
9 | + 'urlManager' => [ | |
10 | + 'enablePrettyUrl' => true, | |
11 | + 'showScriptName' => false, | |
12 | + 'rules' => $rules, | |
13 | + ], | |
8 | 14 | ], |
9 | 15 | ]; | ... | ... |
console/migrations/m150818_125718_create_user_180815.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | + | |
4 | +use yii\db\Schema; | |
5 | +use yii\db\Migration; | |
6 | + | |
7 | + | |
8 | +class m150818_125718_create_user_180815 extends Migration | |
9 | +{ | |
10 | + public function up() | |
11 | + { | |
12 | + | |
13 | + | |
14 | + $user_array = [ | |
15 | + 'username' => 'admin', | |
16 | + 'auth_key' => 'admin', | |
17 | + 'password_hash' => Yii::$app->security->generatePasswordHash('admin'), | |
18 | + 'password_reset_token' => 'admin', | |
19 | + 'email'=> 'admin@test.com', | |
20 | + 'status' => '10', | |
21 | + 'created_at'=>'000000', | |
22 | + 'updated_at' => '000000' | |
23 | + ]; | |
24 | + $this->insert('{{%user}}', $user_array); | |
25 | + } | |
26 | + | |
27 | + | |
28 | + | |
29 | + public function down() | |
30 | + { | |
31 | + $this->dropTable('{{%user}}'); | |
32 | + } | |
33 | + | |
34 | + /* | |
35 | + // Use safeUp/safeDown to run migration code within a transaction | |
36 | + public function safeUp() | |
37 | + { | |
38 | + } | |
39 | + | |
40 | + public function safeDown() | |
41 | + { | |
42 | + } | |
43 | + */ | |
44 | +} | ... | ... |