Skip to content

Commit dd06bf4

Browse files
committed
Add config options for database table prefixes and custom user tables
1 parent 03f39fc commit dd06bf4

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
8080

8181
6. Run the migrations to generate your roles and permissions tables
8282

83+
Please note that if you are upgrading to 6.0 from a previous version, the default column type for the id on the users table has changed. On certain databases foreign keys can only be defined with matching column types. As such, you will need to change the id column on your users table to bigInteger in to user this package.
84+
8385
```
8486
php artisan migrate
8587
```

src/config/acl.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
<?php
22

33
return [
4+
5+
/*
6+
/--------------------------------------------------------------------------
7+
/ Custom Database Options
8+
/--------------------------------------------------------------------------
9+
/
10+
/ If you want to add a prefix to your acl tables, or if you use a different
11+
/ table for your user class, define it here
12+
*/
13+
14+
'db_prefix' => '',
15+
'users_table' => '',
16+
417
/*
518
|--------------------------------------------------------------------------
619
| Model Definitions

src/migrations/2015_02_07_172633_create_role_user_table.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class CreateRoleUserTable extends Migration
1313
public function __construct()
1414
{
1515
$this->prefix = config('acl.db_prefix');
16+
$this->users_table = config('acl.users_table') === '' ? 'users' : config('acl.users_table');
1617
}
1718

1819
/**
@@ -37,7 +38,7 @@ public function up()
3738

3839
$table->foreign('user_id')
3940
->references('id')
40-
->on(config('acl.users_table'))
41+
->on()
4142
->onDelete('cascade');
4243
});
4344
}

0 commit comments

Comments
 (0)