public function setupFoundorAndBaseRolsPermission() { // Create Roles $founder = new App\Role(); $founder->name = 'Founder'; $founder->save(); $admin = new App\Role(); $admin->name = 'Admin'; $admin->save(); // Create User $user = App\User::create(['github_id' => 1, 'github_url' => 'goodgoto.com', 'name' => 'summerblue']); // Attach Roles to user $user->roles()->attach($founder->id); // Create Permissions $manageTopics = new App\Permission(); $manageTopics->name = 'manage_topics'; $manageTopics->display_name = 'Manage Topics'; $manageTopics->save(); $manageUsers = new App\Permission(); $manageUsers->name = 'manage_users'; $manageUsers->display_name = 'Manage Users'; $manageUsers->save(); // Assign Permission to Role $founder->perms()->sync([$manageTopics->id, $manageUsers->id]); $admin->perms()->sync([$manageTopics->id]); }
/** * Run the database seeds. * * @return void */ public function run() { $admin = new \App\Role(); $admin->name = 'admin'; $admin->display_name = 'Administrador'; // optional $admin->description = 'Administrador de permisos del sitio'; // optional $admin->save(); $driver = new \App\Role(); $driver->name = 'driver'; $driver->display_name = 'Conductor'; // optional $driver->description = 'Conductor de las unidades'; // optional $driver->save(); $accountant = new \App\Role(); $accountant->name = 'accountant'; $accountant->display_name = 'Contador'; // optional $accountant->description = 'Encargado de la autorización de los viajes'; // optional $accountant->save(); $user = \App\User::create(['username' => 'adminadhl', 'name' => 'Administrador', 'password' => bcrypt('123456'), 'email' => '*****@*****.**']); $user2 = \App\User::create(['username' => 'chofer1', 'name' => 'Chofer #1', 'password' => bcrypt('123456'), 'email' => '*****@*****.**']); $user3 = \App\User::create(['username' => 'contador1', 'name' => 'Contador #1', 'password' => bcrypt('123456'), 'email' => '*****@*****.**']); $user->attachRole($admin); }
/** * Run the database seeds. * * @return void */ public function run() { $create = ['admin', 'staff', 'guest']; foreach ($create as $key => $value) { $roles = new App\Role(); $roles->role = $value; $roles->save(); } }
/** * Run table seeds. */ public function run() { $roles = [['name' => 'Admin', 'level' => 1], ['name' => 'Moderator', 'level' => 2], ['name' => 'User', 'level' => 3]]; foreach ($roles as $role) { $roleModel = new \App\Role(); $roleModel->name = $role['name']; $roleModel->level = $role['level']; $roleModel->save(); } }
/** * Run the database seeds. * * @return void */ public function run() { // Add a permissions to a role $role = App\Role::where('name', 'super')->first(); // Manajemen user dan kuis untuk psikotes dan penerimaan karyawan baru. $role = App\Role::where('name', 'hrd')->first(); $role->addPermission('user.create'); $role->addPermission('user.edit'); $role->addPermission('user.delete'); $role->addPermission('quiz.create'); $role->addPermission('quiz.edit'); $role->addPermission('quiz.delete'); // Akses ke informasi hukum dari user. $role = App\Role::where('name', 'law')->first(); $role->addPermission('user.law.create'); $role->addPermission('user.law.edit'); $role->addPermission('user.law.delete'); // Akses ke informasi kesehatan dari user. $role = App\Role::where('name', 'healthcare')->first(); $role->addPermission('user.healthcare.create'); $role->addPermission('user.healthcare.edit'); // Bisa buat artikel, post ke facebook dan twitter. $role = App\Role::where('name', 'marketing')->first(); $role->addPermission('article.create'); $role->addPermission('article.edit'); $role->addPermission('article.delete'); $role->addPermission('facebook.post'); $role->addPermission('twitter.post'); // ... Add other role permission if necessary }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('role_user')->truncate(); // Making an admin user $user = App\User::where('name', '=', 'Manish Dwibedy')->first(); $admin = App\Role::where('name', '=', 'admin')->first(); // role attach alias $user->attachRole($admin); // parameter can be an Role object, array, or id // Making a manager user $user = App\User::where('name', '=', 'manager')->first(); $manager = App\Role::where('name', '=', 'manager')->first(); // role attach alias $user->attachRole($manager); // parameter can be an Role object, array, or id // Making a supervisor user $user = App\User::where('name', '=', 'supervisor')->first(); $supervisor = App\Role::where('name', '=', 'supervisor')->first(); // role attach alias $user->attachRole($supervisor); // parameter can be an Role object, array, or id // Making a caller user $user = App\User::where('name', '=', 'caller')->first(); $caller = App\Role::where('name', '=', 'caller')->first(); // role attach alias $user->attachRole($caller); // parameter can be an Role object, array, or id // Making a caller user $user = App\User::where('name', '=', 'caller2')->first(); $caller = App\Role::where('name', '=', 'caller')->first(); // role attach alias $user->attachRole($caller); // parameter can be an Role object, array, or id }
public function run() { DB::table('roles')->delete(); App\Role::create(['name' => 'admin', 'display_name' => 'Administrator', 'description' => 'Administrator is allowed to manage whole software']); App\Role::create(['name' => 'master', 'display_name' => 'Master', 'description' => 'Master is allowed to manage master section of software']); App\Role::create(['name' => 'master-add', 'display_name' => 'Add', 'description' => 'Add is allowed to manage master section of software']); App\Role::create(['name' => 'master-view', 'display_name' => 'View', 'description' => 'View is allowed to manage master section of software']); App\Role::create(['name' => 'master-edit', 'display_name' => 'Edit', 'description' => 'Edit is allowed to manage master section of software']); App\Role::create(['name' => 'master-delete', 'display_name' => 'Delete', 'description' => 'Delete is allowed to manage master section of software']); App\Role::create(['name' => 'transaction', 'display_name' => 'Transaction', 'description' => 'Transaction is allowed to manage transaction section of software']); App\Role::create(['name' => 'transaction-add', 'display_name' => 'Add', 'description' => 'Add is allowed to manage transaction section of software']); App\Role::create(['name' => 'transaction-view', 'display_name' => 'View', 'description' => 'View is allowed to manage transaction section of software']); App\Role::create(['name' => 'transaction-edit', 'display_name' => 'Edit', 'description' => 'Edit is allowed to manage transaction section of software']); App\Role::create(['name' => 'transaction-delete', 'display_name' => 'Delete', 'description' => 'Delete is allowed to manage transaction section of software']); App\Role::create(['name' => 'bill', 'display_name' => 'Bill', 'description' => 'Bill is allowed to manage bill section of software']); App\Role::create(['name' => 'bill-add', 'display_name' => 'Add', 'description' => 'Add is allowed to manage bill section of software']); App\Role::create(['name' => 'bill-view', 'display_name' => 'View', 'description' => 'View is allowed to manage bill section of software']); App\Role::create(['name' => 'bill-edit', 'display_name' => 'Edit', 'description' => 'Edit is allowed to manage bill section of software']); App\Role::create(['name' => 'bill-delete', 'display_name' => 'Delete', 'description' => 'Delete is allowed to manage bill section of software']); App\Role::create(['name' => 'fleet', 'display_name' => 'Fleet', 'description' => 'Fleet is allowed to manage fleet section of software']); App\Role::create(['name' => 'fleet-add', 'display_name' => 'Add', 'description' => 'Add is allowed to manage fleet section of software']); App\Role::create(['name' => 'fleet-view', 'display_name' => 'View', 'description' => 'View is allowed to manage fleet section of software']); App\Role::create(['name' => 'fleet-edit', 'display_name' => 'Edit', 'description' => 'Edit is allowed to manage fleet section of software']); App\Role::create(['name' => 'fleet-delete', 'display_name' => 'Delete', 'description' => 'Delete is allowed to manage fleet section of software']); App\Role::create(['name' => 'accounts', 'display_name' => 'Accounts', 'description' => 'Accounts is allowed to manage accounts section of software']); App\Role::create(['name' => 'accounts-add', 'display_name' => 'Add', 'description' => 'Add is allowed to manage accounts section of software']); App\Role::create(['name' => 'accounts-view', 'display_name' => 'View', 'description' => 'View is allowed to manage accounts section of software']); App\Role::create(['name' => 'accounts-edit', 'display_name' => 'Edit', 'description' => 'Edit is allowed to manage accounts section of software']); App\Role::create(['name' => 'accounts-delete', 'display_name' => 'Delete', 'description' => 'Delete is allowed to manage accounts section of software']); App\Role::create(['name' => 'reports', 'display_name' => 'Reports', 'description' => 'Reports is allowed to manage reports section of software']); App\Role::create(['name' => 'reports-add', 'display_name' => 'Add', 'description' => 'Add is allowed to manage reports section of software']); App\Role::create(['name' => 'reports-view', 'display_name' => 'View', 'description' => 'View is allowed to manage reports section of software']); App\Role::create(['name' => 'reports-edit', 'display_name' => 'Edit', 'description' => 'Edit is allowed to manage reports section of software']); App\Role::create(['name' => 'reports-delete', 'display_name' => 'Delete', 'description' => 'Delete is allowed to manage reports section of software']); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); App\Role::insert([['name' => 'Kasie Keuangan'], ['name' => 'PUMK'], ['name' => 'PR 2']]); // $this->call(UserTableSeeder::class); Model::reguard(); }
/** * Run the database seeds. * * @return void */ public function run() { $arr = ['Admin', 'Moderator', 'Staff', 'User']; foreach ($arr as $role) { App\Role::create(['name' => strtolower($role), 'label' => $role, 'description' => 'Edit the description for ' . $role]); } }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker::create(); DB::table('users')->delete(); $user = App\User::insert(['name' => 'phuong', 'email' => 'phuongpt31', 'password' => bcrypt('zxcv1234')]); $role = App\Role::insert(['name' => 'admin', 'slug' => 'admin']); $user->roles()->save($role); }
/** * Run the database seeds. * * @return void */ public function run() { // create admin role $roleAdmin = App\Role::create(['name' => 'admin', 'label' => 'Administrador del sistema']); foreach (App\Permission::all() as $permission) { $roleAdmin->grantPermission($permission); } }
public function run() { DB::table('roles')->delete(); App\Role::create(['title' => 'Admin', 'code' => 'admin', 'description' => 'Администратор системы', 'sort' => '0', 'visible' => false]); App\Role::create(['title' => 'Оператор', 'code' => 'operator', 'description' => 'Оператор Call центра', 'sort' => '1', 'visible' => true]); App\Role::create(['title' => 'Менеджер', 'code' => 'manager', 'description' => 'Менеджер проекта', 'sort' => '2', 'visible' => true]); App\Role::create(['title' => 'Заказчик', 'code' => 'client', 'description' => 'Заказчик', 'sort' => '3', 'visible' => true]); }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker\Factory::create(); // DB::table('users')->delete(); $user = App\User::create(['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt('password'), 'remember_token' => str_random(10)]); $adminRole = App\Role::create(['name' => 'Admin']); $customerRole = App\Role::create(['name' => 'Customer']); $user->roles()->attach($adminRole->id); }
/** * Run the database seeds. * * @return void */ public function run() { foreach (Config('predefined.roles-and-perms.Roles') as $name => $label) { $role = new \App\Role(); switch (is_numeric($name)) { case false: $role->name = $name; $role->label = $label; break; case true: $role->name = $label; break; } $role->created_at = \Carbon\Carbon::now(); $role->save(); $this->grantPermissions($role); } }
public function run() { // Uncomment the below to wipe the table clean before populating DB::table('roles')->delete(); $faker = $this->getFaker(); for ($i = 0; $i < 10; $i++) { App\Role::create(['name' => $faker->unique()->word]); } }
/** * Run the database seeds. * * @return void */ public function run() { $admin = new \App\Role(); $admin->name = 'admin'; $admin->display_name = 'Administrator'; $admin->save(); \App\User::all()->first()->attachRole($admin); $super = new \App\Role(); $super->name = 'supervisor'; $super->display_name = 'Supervisor'; $super->save(); $member = new \App\Role(); $member->name = 'member'; $member->display_name = 'Member'; $member->save(); \App\User::where('id', '=', 2)->first()->attachRole($member); \App\User::where('id', '=', 3)->first()->attachRole($member); }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('roles', function (Blueprint $table) { $table->increments('id'); $table->string('title'); }); Schema::create('users_roles_rel', function (Blueprint $table) { $table->integer('user_id')->unsigned(); $table->integer('role_id')->unsigned(); $table->foreign('user_id')->references('id')->on('users'); $table->foreign('role_id')->references('id')->on('roles'); }); $adminRole = new \App\Role(["title" => "admin"]); $adminRole->save(); $userRole = new \App\Role(["title" => "user"]); $userRole->save(); $rescueRole = new \App\Role(["title" => "rescue"]); $rescueRole->save(); }
/** * Run the database seeds. * * @return void */ public function run() { $admin = new \App\Role(); $admin->name = 'admin'; $admin->display_name = 'Administrator'; $admin->save(); $super = new \App\Role(); $super->name = 'supervisor'; $super->display_name = 'Supervisor'; $super->save(); $member = new \App\Role(); $member->name = 'member'; $member->display_name = 'Member'; $member->save(); \App\User::find(1)->attachRole($admin); \App\User::find(2)->attachRole($admin); \App\User::find(3)->attachRole($super); \App\User::find(4)->attachRole($member); }
/** * Run the database seeds. * * @return void */ public function run() { //make an administrator $admin = new App\User(); $admin->email = "*****@*****.**"; $admin->first_name = "Administrator"; $admin->last_name = "User"; $admin->password = Hash::make("secret"); $admin->save(); $admin->roles()->attach(App\Role::getAdmin()); }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('roles', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->text('description'); $table->text('tasks'); $table->string('reward'); $table->timestamps(); $table->softDeletes(); }); $roles = [['name' => 'Vanguard', 'description' => 'The Vanguard is the public leader of the team. When it comes to keeping morale up and team spirit high, this is your person.', 'tasks' => "[1] Organize and complete all team devotions. |[2] Promote team spirit and maintain peace among recruits.", 'reward' => "One hot pizza"], ['name' => 'Gamemaster', 'description' => 'The Gamemaster will lead the recruits into battle. This position requires one who can be decisive and commit to those decisions made.', 'tasks' => "[1] Lead the team during the challenges. |[2] Coordinate free time challenge participation.", 'reward' => 'Thirty minute gaming session'], ['name' => 'Culinarian', 'description' => 'Training the body and the mind requires fuel. The Culinarian will make sure that all recruits are well fed and ready to give their best.', 'tasks' => "[1] Coordinate food rations for team recruits. |[2] Acquire food from other teams by trading or purchase.", 'reward' => "Two major snacks"], ['name' => 'Technologist', 'description' => "During the course of the training, the Technologist will become well acquainted with the team's terminal, and will handle communication and puzzle-solving.", 'tasks' => "[1] Complete the Digital Quest. |[2] Coordinate the communication between teams and players.", 'reward' => 'One major snack'], ['name' => 'Engineer', 'description' => "The Engineer's skillset is the optimal blend of creativity and problem-solving. This recruit will be instrumental in gaining crucial points for their team.", 'tasks' => "[1] Using supplied materials, construct team's Space Car. |[2] Acquire supplies from another team by trading or purchase.", 'reward' => 'Additional tools/materials']]; foreach ($roles as $role) { $newRole = new \App\Role(); $newRole->name = $role['name']; $newRole->description = $role['description']; $newRole->tasks = $role['tasks']; $newRole->reward = $role['reward']; $newRole->save(); } }
/** * Run the database seeds. * * @return void */ public function run() { /*$roles=['admin','super_admin']; $i=1; foreach ($roles as $role) { $role= new App\Role(['id'=>$i,'role'=>$role]); $role->save(); $i++; }*/ $roles = [['id' => 1, 'role' => 'admin'], ['id' => 2, 'role' => 'super_admin']]; foreach ($roles as $role) { App\Role::firstOrCreate($role); } }
/** * Run the database seeds. * * @return void */ public function run() { $faker = Faker\Factory::create(); // create role $member = new App\Role(); $member->name = 'member'; $member->display_name = 'Member'; // optional $member->save(); $admin = new App\Role(); $admin->name = 'admin'; $admin->display_name = 'Administrator'; // optional $admin->save(); // create permission $memberPlaylist = new App\Permission(); $memberPlaylist->name = 'member-playlist'; $memberPlaylist->display_name = 'Manage Playlist by Member (self)'; $memberPlaylist->save(); $adminPlaylist = new App\Permission(); $adminPlaylist->name = 'admin-playlist'; $adminPlaylist->display_name = 'Manage Playlist by Admin'; $adminPlaylist->save(); // Assign permisson to role $member->attachPermissions([$memberPlaylist]); $admin->attachPermissions([$adminPlaylist]); // create admin $user = App\User::create(['name' => 'administrator', 'email' => '*****@*****.**', 'password' => bcrypt('password')]); // role attach alias $user->attachRole($admin); // create editor foreach (range(1, 3) as $i) { $user = App\User::create(['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt('password')]); // role attach alias $user->attachRole($member); } }
public function setupFounderAndBaseRolesPermission() { $founder = new App\Role(); $founder->name = 'founder'; $founder->display_name = 'Project founder'; $founder->description = 'User is the founder of a given project'; $founder->save(); $admin = new App\Role(); $admin->name = 'admin'; $admin->display_name = 'User Administrator'; $admin->description = 'User is allowed to manage and edit other users'; $admin->save(); $user = new App\User(); $user->username = '******'; $user->email = '*****@*****.**'; $user->password = bcrypt('admin'); $user->is_admin = '1'; $user->save(); if (!$user->save()) { Log::info('Unable to create user ' . $user->username, (array) $user->errors()); } else { Log::info('Create user ' . $user->username . '<' . $user->email . '>'); } $user->attachRole($founder); $createPost = new App\Permission(); $createPost->name = 'manage_contents'; $createPost->display_name = 'Manage contents'; $createPost->description = 'Manage site all contents and post'; $createPost->save(); $editUser = new App\Permission(); $editUser->name = "edit_users"; $editUser->display_name = "Edit user"; $editUser->description = "edit user info"; $editUser->save(); $founder->attachPermission($createPost, $editUser); $admin->attachPermission($createPost); }
public function run() { // disable mysql foreigh key check if (config('database.default') == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); } /** * Setup config */ // Model $model = '\\App\\Role'; // Table $table = 'permission_role'; /** * TODO: Need to setup a config to enable and disable truncate */ // truncate Role table if (config('database.default') == 'mysql') { DB::table($table)->truncate(); } /** * * Attach Role - User * * -------------------------------------- */ // 1 App\Role::findOrFail(1)->permissions()->attach(1); App\Role::findOrFail(1)->permissions()->attach(2); App\Role::findOrFail(1)->permissions()->attach(3); // 2 App\Role::findOrFail(2)->permissions()->attach(2); /** * * END - Insert Data * * -------------------------------------- * -------------------------------------- */ // enable mysql foreigh key check if (config('database.default') == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } }
/** * Run the database seeds. * * @return void */ public function run() { // DB::statement('SET FOREIGN_KEY_CHECKS=0;'); DB::table('permission_role')->truncate(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); // Making an manager role $role = App\Role::where('name', '=', 'manager')->first(); $permission = App\Permission::where('name', '=', 'make-shifts')->first(); // role attach alias $role->attachPermission($permission); // parameter can be an Role object, array, or id // Making an caller role $role = App\Role::where('name', '=', 'caller')->first(); $permission = App\Permission::where('name', '=', 'schedule-shifts')->first(); // role attach alias $role->attachPermission($permission); // parameter can be an Role object, array, or id }
/** * Run the database seeds. * * @return void */ public function run() { // Basic roles data App\Role::insert([['name' => 'admin'], ['name' => 'user']]); // Basic permissions data App\Permission::insert([['name' => 'admin.home'], ['name' => 'user.profile'], ['name' => 'user.post'], ['name' => 'user.editpost'], ['name' => 'user.deletepost']]); // Add a permission to a role $role = App\Role::where('name', 'admin')->first(); $role->addPermission('admin.home'); //Add User Permission $user = App\Role::where('name', 'user')->first(); $user->addPermission('user.profile'); $user->addPermission('user.post'); $user->addPermission('user.editpost'); $user->addPermission('user.deletepost'); // Create a user, and give roles $user = App\User::create(['name' => 'Admin Putri', 'email' => '*****@*****.**', 'password' => bcrypt('200895')]); $user->assignRole('admin'); // $this->call(UserTableSeeder::class); }
public function run() { /** * See http://stackoverflow.com/questions/29448404/faker-and-laravel-5 * for method used to generate users via 'Faker' package. */ $faker = Faker::create(); DB::table('users')->delete(); $roleIds = App\Role::lists('id'); User::create(array('first_name' => 'First', 'last_name' => 'Last', 'email' => '*****@*****.**', 'password' => Hash::make('password'), 'active_ind' => true, 'role_id' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime())); // Create a few 'Administrator' users foreach (range(1, 2) as $index) { User::create(array('first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->email, 'password' => Hash::make($faker->word), 'active_ind' => $faker->boolean($chanceOfGettingTrue = 90), 'role_id' => 1, 'created_at' => new DateTime(), 'updated_at' => new DateTime())); } // Create several 'Super User' users foreach (range(1, 5) as $index) { User::create(array('first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->email, 'password' => Hash::make($faker->word), 'active_ind' => $faker->boolean($chanceOfGettingTrue = 90), 'role_id' => 2, 'created_at' => new DateTime(), 'updated_at' => new DateTime())); } // Create many 'User' users foreach (range(1, 100) as $index) { User::create(array('first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->email, 'password' => Hash::make($faker->word), 'active_ind' => $faker->boolean($chanceOfGettingTrue = 90), 'role_id' => 3, 'created_at' => new DateTime(), 'updated_at' => new DateTime())); } //DB::table('users')->insert($users); }
/** * Run the database seeds. * * @return void */ public function run() { $now = Carbon\Carbon::now(); // Basic roles data App\Role::insert([['name' => 'super', 'created_at' => $now, 'updated_at' => $now], ['name' => 'hrd', 'created_at' => $now, 'updated_at' => $now], ['name' => 'law', 'created_at' => $now, 'updated_at' => $now], ['name' => 'marketing', 'created_at' => $now, 'updated_at' => $now], ['name' => 'healthcare', 'created_at' => $now, 'updated_at' => $now]]); }
<?php Route::bind('user', function ($id) { return App\User::whereId($id)->first(); }); Route::bind('student', function ($id) { return App\Student::whereStudentId($id)->first(); }); Route::bind('role', function ($id) { return App\Role::whereId($id)->first(); }); Route::bind('information', function ($id) { return App\Information::whereId($id)->first(); }); /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', ['as' => 'home', 'uses' => 'HomeController@index']); Route::get('home', ['as' => 'home', 'uses' => 'HomeController@index']); // AUTH CONTROLLERS Route::controllers(['auth' => 'Auth\\AuthController', 'password' => 'Auth\\PasswordController']); // USER Route::resource('user', 'UserController'); post('update/{user_id}/role', ['as' => 'update_role', 'uses' => 'UserController@updateRoles']);
/** * Run the database seeds. * * @return void */ public function run() { // roles $admin = new \App\Role(); $admin->name = 'admin'; $admin->display_name = 'User Administrator'; $admin->description = 'User is allowed to manage and edit other users'; $admin->save(); $librarian = new \App\Role(); $librarian->name = 'librarian'; $librarian->display_name = 'User Librarian'; $librarian->description = 'User is allowed to manage the library'; $librarian->save(); $employee = new \App\Role(); $employee->name = 'employee'; $employee->display_name = 'User Employee'; $employee->description = 'User is allowed to rent, to reserve and to return the library copies'; $employee->save(); $teacher = new \App\Role(); $teacher->name = 'teacher'; $teacher->display_name = 'User Teacher'; $teacher->description = 'User is allowed to rent, to reserve and to return the library copies'; $teacher->save(); $student = new \App\Role(); $student->name = 'student'; $student->display_name = 'User Student'; $student->description = 'User is allowed to rent, to reserve and to return the library copies'; $student->save(); // permissions $toLoan = new \App\Permission(); $toLoan->name = 'to-loan'; $toLoan->display_name = 'To Loan'; $toLoan->description = 'To loan copies of works for students, teacher and employees'; $toLoan->save(); $librarian->attachPermission($toLoan); $toReserve = new \App\Permission(); $toReserve->name = 'to-reserve'; $toReserve->display_name = 'To Reserve'; $toReserve->description = 'To reserve copies of works for students, teacher and employees'; $toReserve->save(); $librarian->attachPermission($toReserve); $toReturn = new \App\Permission(); $toReturn->name = 'to-return'; $toReturn->display_name = 'To Return'; $toReturn->description = 'To return copies of works for students, teacher and employees'; $toReturn->save(); $librarian->attachPermission($toReturn); $toRenew = new \App\Permission(); $toRenew->name = 'to-renew'; $toRenew->display_name = 'To Renew'; $toRenew->description = 'To renew copies of works for students, teacher and employees'; $toRenew->save(); $librarian->attachPermission($toRenew); $addLibrarian = new \App\Permission(); $addLibrarian->name = 'add-librarian'; $addLibrarian->display_name = 'Add Librarian'; $addLibrarian->description = 'Can add librarian user'; $addLibrarian->save(); $admin->attachPermission($addLibrarian); $addEmployee = new \App\Permission(); $addEmployee->name = 'add-employee'; $addEmployee->display_name = 'Add Employee'; $addEmployee->description = 'Can add employee user'; $addEmployee->save(); $admin->attachPermission($addEmployee); $AddTeacher = new \App\Permission(); $AddTeacher->name = 'add-teacher'; $AddTeacher->display_name = 'Add Teacher'; $AddTeacher->description = 'Can add teacher user'; $AddTeacher->save(); $admin->attachPermission($AddTeacher); $addStudent = new \App\Permission(); $addStudent->name = 'add-student'; $addStudent->display_name = 'Add Student'; $addStudent->description = 'Can add student user'; $addStudent->save(); $admin->attachPermission($addStudent); $librarian->attachPermission($addStudent); $editLibrarian = new \App\Permission(); $editLibrarian->name = 'edit-librarian'; $editLibrarian->display_name = 'Edit Librarian'; $editLibrarian->description = 'Can edit librarian user'; $editLibrarian->save(); $admin->attachPermission($editLibrarian); $editEmployee = new \App\Permission(); $editEmployee->name = 'edit-employee'; $editEmployee->display_name = 'Edit Employee'; $editEmployee->description = 'Can edit employee user'; $editEmployee->save(); $admin->attachPermission($editEmployee); $editTeacher = new \App\Permission(); $editTeacher->name = 'edit-teacher'; $editTeacher->display_name = 'Edit Teacher'; $editTeacher->description = 'Can edit teacher user'; $editTeacher->save(); $admin->attachPermission($editTeacher); $editStudent = new \App\Permission(); $editStudent->name = 'edit-student'; $editStudent->display_name = 'Edit Student'; $editStudent->description = 'Can edit student user'; $editStudent->save(); $admin->attachPermission($editStudent); $librarian->attachPermission($editStudent); $editProfile = new \App\Permission(); $editProfile->name = 'edit-profile'; $editProfile->display_name = 'Edit Profile'; $editProfile->description = 'Can edit your user profile'; $editProfile->save(); $admin->attachPermission($editProfile); $librarian->attachPermission($editProfile); $employee->attachPermission($editProfile); $teacher->attachPermission($editProfile); $student->attachPermission($editProfile); $maxThreeCopies = new \App\Permission(); $maxThreeCopies->name = 'max-three-copies'; $maxThreeCopies->display_name = 'Max Three Copies'; $maxThreeCopies->description = 'Can catch loaned a maximum of three copies'; $maxThreeCopies->save(); $employee->attachPermission($maxThreeCopies); $student->attachPermission($maxThreeCopies); $maxFiveCopies = new \App\Permission(); $maxFiveCopies->name = 'max-five-copies'; $maxFiveCopies->display_name = 'Max Copies Five'; $maxFiveCopies->description = 'Can catch loaned a maximum of five copies'; $maxFiveCopies->save(); $teacher->attachPermission($maxFiveCopies); $maxTenDays = new \App\Permission(); $maxTenDays->name = 'max-ten-days'; $maxTenDays->display_name = 'Max Ten Days'; $maxTenDays->description = 'Can catch loaned by a maximum ten days'; $maxTenDays->save(); $employee->attachPermission($maxTenDays); $student->attachPermission($maxTenDays); $maxFifteenDays = new \App\Permission(); $maxFifteenDays->name = 'max-fifteen-days'; $maxFifteenDays->display_name = 'Max Fifteen Days'; $maxFifteenDays->description = 'Can catch loaned by a maximum fifteen days'; $maxFifteenDays->save(); $teacher->attachPermission($maxFifteenDays); $requestRenewal = new \App\Permission(); $requestRenewal->name = 'request-renewal'; $requestRenewal->display_name = 'Request Renewal'; $requestRenewal->description = 'Can request renewal of copies of works'; $requestRenewal->save(); $employee->attachPermission($requestRenewal); $teacher->attachPermission($requestRenewal); $student->attachPermission($requestRenewal); $requestReserve = new \App\Permission(); $requestReserve->name = 'request-reserve'; $requestReserve->display_name = 'Request Reserve'; $requestReserve->description = 'Can request reserve of works'; $requestReserve->save(); $employee->attachPermission($requestReserve); $teacher->attachPermission($requestReserve); $student->attachPermission($requestReserve); }