I'm developing an application in Laravel 4.2 with a MySQL DB. I have the 'users', 'roles_users', and 'roles' tables, with 'role_user' being the pivot table because of the many-to-many relationship. Now, in my application there will be different types of accounts. Some types need to have an extra field unique to them. That field is a foreign key field, linking the type of account to a specific table.
Example:
So, there would be an 'areas' table and a 'sub-areas' table, with extra information. For Account Type A, I would need no extra fields. For B, I would need an 'area_id' field, and for C a 'sub-area_id' field. Where would those fields go? I don't think it would be the 'users' table, since they aren't common fields.
If you need extra information, let me know and I'll do my best to help.
If you want to this cleanly and to expand more in the future, what I would do is create 2 more tables, a permissions table and a permission_role many-to-many table.
for permissions table:
$table->increments('id');
$table->integer('area_id')->unsigned();
$table->integer('subarea_id')->unsigned();
for permission_role table:
$table->increments('id');
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
So you would assign several permissions to each role. And there would be 3 roles (e.g. account_a, account_b, account_c). One weakness would be, if you add a new subarea in an area, e.g. account_a would not automatically have access to it. It would be a bit more complex, but if you want to automate when account_a has access to area x and all of its subareas (e.g. x.1, x.2, x.3), and there's a new subarea x.4 and you would account_a to automatically gain access, you can do this (polymorphic-ish many-to-many):
for permissions table:
$table->increments('id');
$table->string('area_type'); // i.e. either "Area" or "Subarea"
$table->integer('area_access_id')->unsigned(); // this can be an ID to an "Area" or to a "Subarea"
for permission_role table:
$table->increments('id');
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
for area table:
$table->increments('id');
$table->string('name');
for sub_area table:
$table->increments('id');
$table->integer('parent_area_id')->unsigned(); // references area.id
$table->string('name');
Depends on how you are storing these 'areas', if you can reference them then do so. The logical place to link/store this data is in the 'roles' table, this is where all information about your roles and thus permissions should reside. Essentially you'll want to be able to change it with a single update too, so adding this to 'roles' will do that since you'll have a single row for each permission type and this is the place where users will get their permissions.