/** * Seed Role Permissions into the database. */ public function run() { $countryResearcherRole = Role::select('id')->whereName(config('nrgi.roles.country-researcher.name'))->first(); $permission_name = ['add-contract', 'edit-contract', 'edit-text', 'complete-text', 'complete-metadata', 'add-annotation', 'edit-annotation', 'complete-annotation']; $permissions = Permission::whereIn('name', $permission_name)->get(); $countryResearcherRole->perms()->sync($permissions); }
/** * Seed Admin User with Roles */ public function run() { $admin = User::firstOrCreate(['name' => "admin", 'email' => '*****@*****.**', 'password' => Hash::make('admin123'), 'organization' => '', 'status' => 'true']); $adminRole = Role::select('id')->whereName(config('nrgi.roles.superadmin.name'))->first(); $admin->roles()->sync([$adminRole->id]); $researcher = User::firstOrCreate(['name' => "researcher", 'email' => '*****@*****.**', 'password' => Hash::make('researcher123'), 'organization' => '', 'status' => 'true']); $researcherRole = Role::select('id')->whereName(config('nrgi.roles.researcher.name'))->first(); $researcher->roles()->sync([$researcherRole->id]); $permission_name = ['add-contract', 'edit-contract', 'edit-text', 'complete-text', 'complete-metadata', 'add-annotation', 'edit-annotation', 'complete-annotation']; $permissions = Permission::whereIn('name', $permission_name)->get(); $researcherRole->perms()->sync($permissions); }
/** * Seed Permissions into the database. */ public function run() { foreach (config('nrgi.permissions') as $permission) { Permission::firstOrCreate($permission); } }