This repository was archived by the owner on Aug 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 2323 // 数据库连接名称,不填为默认配置.
2424 'connection ' => '' ,
2525
26- // 策略表名.
27- 'casbin_rules_table ' => 'casbin_rule ' ,
26+ // 策略表名(不含表前缀)
27+ 'casbin_rules_name ' => 'casbin_rule ' ,
28+
29+ // 策略表完整名称.
30+ 'casbin_rules_table ' => null ,
2831 ],
2932];
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class CasbinRule extends Migrator
2727 */
2828 public function up ()
2929 {
30- $ table = $ this ->table (config ('casbin.database.casbin_rules_table ' ));
30+ $ table = $ this ->table (config ('casbin.database.casbin_rules_name ' ));
3131 $ table ->addColumn ('ptype ' , 'string ' , ['null ' => true ])
3232 ->addColumn ('v0 ' , 'string ' , ['null ' => true ])
3333 ->addColumn ('v1 ' , 'string ' , ['null ' => true ])
@@ -40,7 +40,7 @@ public function up()
4040
4141 public function down ()
4242 {
43- $ table = $ this ->table (config ('casbin.database.casbin_rules_table ' ));
43+ $ table = $ this ->table (config ('casbin.database.casbin_rules_name ' ));
4444 $ table ->delete ();
4545 }
4646}
Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ class CasbinRule extends Model
88{
99 public function __construct ($ data = [])
1010 {
11- parent ::__construct ($ data );
12-
13- //TODO:初始化内容
1411 $ this ->connection = config ('casbin.database.connection ' ) ?: '' ;
1512
1613 $ this ->table = config ('casbin.database.casbin_rules_table ' );
14+
15+ $ this ->name = config ('casbin.database.casbin_rules_name ' );
16+
17+ parent ::__construct ($ data );
1718 }
1819}
You can’t perform that action at this time.
0 commit comments