Created
February 24, 2014 14:32
-
-
Save bruceoutdoors/9189378 to your computer and use it in GitHub Desktop.
Laravel 4 Entrust boilerplate migration file for adding predefined permissions - https://github.com/Zizaco/entrust
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Illuminate\Database\Schema\Blueprint; | |
class AddPermissions extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
$manageUsers = new Permission; | |
$manageUsers->name = 'manage_users'; | |
$manageUsers->display_name = 'Manage Users'; | |
$manageUsers->save(); | |
$addUsers = new Permission; | |
$addUsers->name = 'add_users'; | |
$addUsers->display_name = 'Add Users'; | |
$addUsers->save(); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Permission::where('name', '=', 'manage_users')->delete(); | |
Permission::where('name', '=', 'add_users')->delete(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment