| Conditions | 4 |
| Paths | 1 |
| Total Lines | 27 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function up() |
||
| 17 | { |
||
| 18 | $config = Manager::getAuthorizableMigration(); |
||
| 19 | |||
| 20 | Schema::create('priv_auth_role', function (Blueprint $table) use ($config) { |
||
| 21 | // Depend on Authorizable table structure |
||
| 22 | // package provides support for tree types |
||
| 23 | // of primaryKey: integer, string & uuid. |
||
| 24 | // |
||
| 25 | if ($config['type'] == 'int') { |
||
| 26 | $table->unsignedInteger('auth_id'); |
||
| 27 | |||
| 28 | } elseif ($config['type'] == 'string') { |
||
| 29 | $table->string('auth_id'); |
||
| 30 | |||
| 31 | } elseif ($config['type'] == 'uuid') { |
||
| 32 | $table->uuid('auth_id'); |
||
| 33 | } |
||
| 34 | $table->unsignedInteger('role_id'); |
||
| 35 | |||
| 36 | $table->foreign('auth_id') |
||
| 37 | ->references($config['key'])->on($config['table']) |
||
| 38 | ->onDelete('CASCADE'); |
||
| 39 | |||
| 40 | $table->foreign('role_id') |
||
| 41 | ->references('id')->on('priv_roles') |
||
| 42 | ->onDelete('CASCADE'); |
||
| 43 | }); |
||
| 58 |