/** * @param $name * @param int $level * @param string $description * @throws Exception */ public function create($name, $level = 1, $description = '') { try { $this->role->create(['name' => ucwords($name), 'slug' => str_slug($name), 'description' => $description, 'level' => $level]); } catch (Exception $e) { echo "- Role {$name} is already created\n"; } }
/** * Run the database seeds. * * @return void */ public function run() { #Sistema de Roles #Creando Roles $adminRole = Role::create(['name' => 'Administrador', 'slug' => 'admin', 'description' => 'Super Usuario - No tiene limites', 'level' => 1]); $operativeRole = Role::create(['name' => 'Operativo', 'slug' => 'operativo', 'description' => 'Usuario estandar - No puede alterar inventario', 'level' => 2]); $faker = Faker\Factory::create(); DB::table('users')->truncate(); // factory(App\User::class)->create(array( // 'first_name' => 'Johan', // 'last_name' => 'Rueda', // 'full_name' => 'Johan Rueda', // 'email' => '*****@*****.**', // 'password' => Hash::make('123456'), // 'type' => 'administrador' // )); // factory(App\User::class,49)->create(); $id_admin = \DB::table('users')->insertGetId(array('first_name' => 'Johan', 'last_name' => 'Rueda', 'full_name' => 'Johan Rueda', 'email' => '*****@*****.**', 'password' => bcrypt('jrrg*4543'))); $admin_role = User::find($id_admin); $admin_role->attachRole($adminRole); \DB::table('user_profiles')->insert(array('user_id' => $id_admin, 'bio' => "Administrador Root del sistema", 'website' => 'saludver.dev', 'twitter' => 'https://twitter.com/JjdjJohan')); // Usuarios de Prueba: for ($i = 0; $i < 3; $i++) { $first_name = $faker->name; $last_name = $faker->name; $id = \DB::table('users')->insertGetId(array('first_name' => $first_name, 'last_name' => $last_name, 'full_name' => $first_name . ' ' . $last_name, 'email' => $faker->unique()->email, 'password' => bcrypt('123456'))); \DB::table('user_profiles')->insert(array('user_id' => $id, 'bio' => $faker->paragraph(rand(2, 5)), 'website' => '', 'twitter' => '')); $operative_role = User::find($id); $operative_role->attachRole($operativeRole); } }
public function run() { /* * Create user and role ADMIN */ $user = User::create(['name' => 'admin', 'email' => '*****@*****.**', 'password' => 'admin']); $adminRole = Role::create(['name' => 'Admin', 'slug' => 'admin']); $user->attachRole($adminRole); /* * Create user and role MODERATOR */ $user = User::create(['name' => 'moderator', 'email' => '*****@*****.**', 'password' => 'moderator']); $moderatorRole = Role::create(['name' => 'Moderator', 'slug' => 'moderator']); $user->attachRole($moderatorRole); /* * Create user and role USER */ $user = User::create(['name' => 'user', 'email' => '*****@*****.**', 'password' => 'user']); $userRole = Role::create(['name' => 'User', 'slug' => 'user']); $user->attachRole($userRole); /* * Create user and role badUser - not verified user */ $user = User::create(['name' => 'test', 'email' => '*****@*****.**', 'password' => 'test']); $badUserRole = Role::create(['name' => 'badUser', 'slug' => 'bad.user']); $user->attachRole($badUserRole); }
/** * Run the migrations. * * @return void */ public function up() { // Role::create(['name' => 'Pastor', 'slug' => 'pastor']); Role::create(['name' => 'Zone Leader', 'slug' => 'zone.leader']); Role::create(['name' => 'Volunteer', 'slug' => 'volunteer']); }
/** * Run the database seeds. * * @return void */ public function run() { $adminRole = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => '', 'level' => 1]); $userAdmin = User::create(['staff_code' => 'IVC00001', 'full_name' => 'Nguyen Tai Hanh', 'email' => '*****@*****.**', 'password' => Hash::make('12345678'), 'phone_number' => '01676460626', 'user_status' => 'Working']); //attached role $userAdmin->attachRole($adminRole); }
/** * Run the database seeds. * * @return void */ public function run() { $adminRole = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => '', 'level' => 1]); $adminRole = Role::create(['name' => 'Secretaria', 'slug' => 'secretaria', 'description' => '', 'level' => 2]); $adminRole = Role::create(['name' => 'Especialista', 'slug' => 'especialista', 'description' => '', 'level' => 3]); $adminRole = Role::create(['name' => 'Usuario', 'slug' => 'usuario', 'description' => '', 'level' => 4]); }
/** * Run the migrations. * * @return void */ public function up() { $root = Role::create(['name' => 'Root', 'slug' => 'root', 'description' => 'Super user']); $admin = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => 'Administrator aplikasi']); $user = Role::create(['name' => 'User', 'slug' => 'user', 'description' => 'User biasa']); $user = \App\User::create(['name' => 'Root', 'email' => '*****@*****.**', 'password' => 'root']); $user->attachRole($root); }
public function run() { TestDummy::times(1)->create('Bican\\Roles\\Models\\Role'); Role::create(['name' => 'Printeron', 'slug' => 'Printeron', 'description' => 'Dostep tylko dla pracownikow Printon', 'level' => '40']); Role::create(['name' => 'Printing House', 'slug' => preg_replace('/[\\s-]+/', '-', 'Printing House'), 'description' => 'Drukarnia', 'level' => '30']); Role::create(['name' => 'Advertising Agency', 'slug' => "Advertising-Agency", 'description' => 'Dostep tylko dla Agencji reklamowych', 'level' => '20']); Role::create(['name' => 'Client', 'slug' => "Client", 'description' => 'Klient', 'level' => '10']); }
public function run() { $secSectorial = Role::create(['name' => 'secSectorial', 'slug' => 'sec_sectorial', 'description' => 'Secretaría Sectorial', 'level' => '1']); $secMunicipal = Role::create(['name' => 'secMunicipal', 'slug' => 'sec_municipal', 'description' => 'Secretaría de Planeación Municipal', 'level' => '2']); $secDepartmental = Role::create(['name' => 'secDepartamenta', 'slug' => 'sec_departamental', 'description' => 'Secretaría de Planeación Departamental', 'level' => '3']); $adminMunicipalRole = Role::create(['name' => 'AdminMunicipal', 'slug' => 'admin_municipal', 'description' => 'Administración - Planeación Municipal', 'level' => '4']); $adminDepartamentalRole = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => 'Administración - Planeación Departamental', 'level' => '5']); }
/** * Run the database seeds. * * @return void */ public function run() { $roles = []; $roles[] = array('name' => 'Admin', 'slug' => 'admin', 'description' => 'The administrator of the website', 'level' => 1); $roles[] = array('name' => 'User', 'slug' => 'user', 'description' => 'The user who register in the website and he/she is not legal', 'level' => 1); $roles[] = array('name' => 'Legal', 'slug' => 'legal', 'description' => 'The user who register and he/she is legal', 'level' => 1); foreach ($roles as $role) { Role::create($role); } }
public function run() { $faker = $this->beginSeeding(new Role()); $permissions = Permission::lists('id')->toArray(); $roles = config('acl.roles'); foreach ($roles as $slug => $level) { $role = Role::create(['name' => ucfirst($slug), 'slug' => $slug, 'level' => $level]); $role->attachPermission($faker->randomElement($permissions)); } $this->endSeeding(); }
/** * Run the database seeds. * * @return void */ public function run() { $architectRole = Role::create(['name' => 'Architect', 'slug' => 'architect', 'description' => 'Architect', 'level' => 1]); $salesRepRole = Role::create(['name' => 'Sales Rep', 'slug' => 'sales.reps', 'description' => '', 'level' => 1]); $buyerRole = Role::create(['name' => 'Buyers', 'slug' => 'buyers', 'description' => '', 'level' => 1]); $adminRole = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => '', 'level' => 1]); $date = new DateTime(); //CREATES DUMMY USERS $user = User::create(['name' => 'Dummy User', 'email' => '*****@*****.**', 'password' => bcrypt('secret'), 'birthday' => $date->setDate(1999, 1, 1)]); $user->attachRole($architectRole); }
public function create(Request $request) { $data = ['name' => $request->input('name'), 'slug' => $request->input('slug'), 'description' => $request->input('description'), 'level' => $request->input('level')]; $validator = Validator::make($data, ['name' => 'required', 'slug' => 'required|unique:roles,slug|alpha', 'level' => 'required|integer']); if ($validator->fails()) { $request->flash(); return view('admin.role.show', ['act' => 'create', 'role' => [], 'errors' => $validator->messages()]); } else { $role = Role::create($data); return redirect('admin/role'); } }
/** * Store a newly created resource in storage. * * @return \Illuminate\Http\Response */ public function store(RoleRequest $request) { // Check authorisation and throw 404 if not if (!$this->authorised('create')) { return view('errors/404'); } // Create Leave Role::create($request->all()); Toastr::success("Created new role", "Success"); $roles = Role::all(); return view('manage/role/list', compact('roles')); }
/** * Run the database seeds. * * @return void */ public function run() { // $rol = Role::create(['name' => 'Administrador', 'slug' => 'Administrador', 'description' => 'Rol que tiene todos los permisos']); $rol2 = Role::create(['name' => 'Ejecutivo', 'slug' => 'Ejecutivo', 'description' => 'Acceso solo a la vista de reportes']); $user1 = User::find(1); $user2 = User::find(2); $user3 = User::find(3); //El cuarto es solo de ejemplo para probar el otro rol y los permismos $user4 = User::find(4); $user1->attachRole($rol->id); $user2->attachRole($rol->id); $user3->attachRole($rol->id); $user4->attachRole($rol2->id); }
/** * Run the database seeds. * * @return void */ public function run() { $rol = Role::create(['name' => 'Administrador', 'slug' => 'Administrador', 'description' => 'Rol que tiene todos los permisos']); $rol2 = Role::create(['name' => 'Técnico', 'slug' => 'Tecnico', 'description' => 'Todos los permisos excepto crear usuarios']); $rol3 = Role::create(['name' => 'Becario', 'slug' => 'Becario', 'description' => 'Todos los permisos excepto reportes y crear usuarios']); $user1 = User::find(1); $user2 = User::find(2); $user3 = User::find(3); $user4 = User::find(4); $user5 = User::find(5); $user1->attachRole($rol->id); $user2->attachRole($rol->id); $user3->attachRole($rol2->id); $user4->attachRole($rol2->id); $user5->attachRole($rol2->id); }
/** * Run the database seeds. * * @return void */ public function run() { $adminRole = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => '', 'level' => 1]); $userRole = Role::create(['name' => 'User', 'slug' => 'user']); /*管理员初始化所有权限*/ $all_permissions = Permission::all(); foreach ($all_permissions as $all_permission) { $adminRole->attachPermission($all_permission); } // 一般用户初始化 菜单管理权限 $menuManagePer = Permission::where('slug', '=', 'show.menu.manage')->first(); $menuListPer = Permission::where('slug', '=', 'show.menu.list')->first(); $loginBackend = Permission::where('slug', '=', 'login.backend')->first(); $userRole->attachPermission($menuManagePer); $userRole->attachPermission($menuListPer); $userRole->attachPermission($loginBackend); }
public function run() { DB::statement("SET foreign_key_checks = 0"); DB::table('roles')->truncate(); /* ** Define role */ $superAdminRole = Role::create(['name' => 'Superadmin', 'slug' => 'superadmin']); $adminRole = Role::create(['name' => 'Admin', 'slug' => 'admin']); $districtRole = Role::create(['name' => 'Admin Kecamatan', 'slug' => 'admin_district']); /* ** Attach role */ $admin_id = 1; $user = User::find($admin_id); $user->attachRole($superAdminRole); }
/** * Run the migrations. * * @return void */ public function up() { Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => 'Admin role for the fieldwork user account, has all the power', 'level' => 2]); Role::create(['name' => 'Events Contributor', 'slug' => 'contributor', 'description' => 'Grants access to creating/deleting/editing events to contributors and collaborators', 'level' => 1]); /* | | Temp Migration Code! | No other way to seed the first admin user, will add a | method for an admin to make more admins though. | */ // change this to grant admin to anyone with a fieldwork email. $fieldworkUsers = User::where('email', 'like', '*****@*****.**')->get(); $adminRole = Role::where('slug', '=', 'admin')->first(); foreach ($fieldworkUsers as $user) { $user->attachRole($adminRole); $user->save(); } }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::table('groups')->delete(); DB::table('users')->delete(); DB::table('password_resets')->delete(); DB::table('rules')->delete(); DB::table('roles')->delete(); DB::table('role_user')->delete(); DB::table('permissions')->delete(); DB::table('permission_user')->delete(); DB::table('permission_role')->delete(); $admin_role = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => '']); $group_admin_role = Role::create(['name' => 'Group Admin', 'slug' => 'groupadmin', 'description' => '']); $torino = Group::create(['name' => 'Torino']); $milano = Group::create(['name' => 'Milano']); $u = User::create(['name' => 'Amministratore', 'surname' => 'Generale', 'username' => 'admin', 'email' => '*****@*****.**', 'password' => Hash::make('cippalippa'), 'group_id' => $torino->id]); $u->attachRole($admin_role); $u = User::create(['name' => 'Amministratore', 'surname' => 'Torino', 'username' => 'admin_to', 'email' => '*****@*****.**', 'password' => Hash::make('cippalippa'), 'group_id' => $torino->id]); $u->attachRole($group_admin_role); Model::reguard(); }
/** * Run the migrations. * * @return void */ public function up() { // Role::create(['name' => 'Area Leader', 'slug' => 'area.leader']); }
/** * Run the database seeds. * * @return void */ public function run() { Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => 'Admin Levelled User', 'level' => 1]); Role::create(['name' => 'Dokter', 'slug' => 'dokter', 'description' => 'Dokter Levelled User', 'level' => 1]); Role::create(['name' => 'Super User', 'slug' => 'super.user', 'description' => 'Super User Levelled User', 'level' => 2]); }
public function createRoles() { Role::create(['name' => 'Admin', 'slug' => 'admin']); Role::create(['name' => 'Moderator', 'slug' => 'moderator']); Role::create(['name' => 'User', 'slug' => 'user']); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { Role::create(['name' => $request['name'], 'slug' => $request['name'], 'description' => $request['description'], 'level' => $request['level'], 'status' => $request['status']]); return redirect('/roles')->with('message', 'Datos Guardados Correctamente'); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { Role::create(['name' => $request->input('name'), 'slug' => str_slug($request->input('name')), 'description' => $request->input('description'), 'level' => 1]); return redirect()->route('role.index'); }
/** * Run the database seeds. * * @return void */ public function run() { Role::create(['name' => 'Cashier', 'slug' => 'cashier', 'description' => 'Cashier Admin User', 'level' => 1]); Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => 'Super Admin User', 'level' => 2]); }
/** * Run the database seeds. * * @return void */ public function run() { // $adminRole = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => '', 'level' => 1]); $moderatorRole = Role::create(['name' => 'Forum Moderator', 'slug' => 'forum.moderator']); }
/** * Store role in database. * * @param CreateRole $request * @return \Illuminate\Http\RedirectResponse */ public function createRole(CreateRole $request) { Role::create($request->all()); $request->session()->flash('flash_message', 'Role successfully added!'); return redirect()->back(); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Grupo $request) { $role = Role::create($request->all()); flash()->overlay('El grupo ha sido creado', 'El grupo ' . $role->name); return redirect('role'); }
<?php use Bican\Roles\Models\Role; $architectRole = Role::create(['name' => 'Architect', 'slug' => 'architect', 'description' => 'Architect', 'level' => 1]); $salesRepRole = Role::create(['name' => 'Sales Rep', 'slug' => 'sales.reps', 'description' => '', 'level' => 1]); $buyerRole = Role::create(['name' => 'Buyers', 'slug' => 'buyers', 'description' => '', 'level' => 1]); $adminRole = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => '', 'level' => 1]); $user = User::create(['name' => 'Test Name', 'email' => '*****@*****.**', 'password' => bcrypt(123456)]); $user = User::create(['name' => 'Taylor', 'email' => '*****@*****.**', 'password' => bcrypt(123456)]);