Skip to content

Commit

Permalink
updated migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
farhoudi committed Feb 11, 2021
1 parent 5c7a188 commit 2ea6962
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Laravel Role Based Access Control for Laravel 5+.
Require via composer:

```
composer require farhoudi/laravel-rbac
composer require farhoudi/laravel-rbac:^1
```

Register service provider to the `providers` array in `config/app.php`
Expand Down
8 changes: 7 additions & 1 deletion src/migrations/2020_11_06_165959_create_rbac_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public function up() {
$table->string('name');
$table->string('alias')->unique()->nullable();
$table->text('description')->nullable();
$table->bigInteger('group_id')->unsigned();
$table->bigInteger('group_id')->unsigned()->nullable();
$table->timestamps();

$table->foreign('group_id')->references('id')->on('rbac_permission_groups');
});

Schema::create('rbac_permission_role', function (Blueprint $table) {
Expand All @@ -42,6 +44,8 @@ public function up() {

$table->foreign('permission_id')->references('id')->on('rbac_permissions');
$table->foreign('role_id')->references('id')->on('rbac_roles');

$table->primary(['permission_id', 'role_id']);
});

Schema::create('rbac_role_user', function (Blueprint $table) {
Expand All @@ -54,6 +58,8 @@ public function up() {
} catch (Exception $ex) {
$table->index('user_id');
}

$table->primary(['role_id', 'user_id']);
});
}

Expand Down

0 comments on commit 2ea6962

Please sign in to comment.