示例#1
0
 public function run()
 {
     DB::table('roles')->truncate();
     DB::table('role_user')->truncate();
     DB::table('permissions')->truncate();
     DB::table('permission_role')->truncate();
     $roles = [['name' => 'admin', 'display_name' => 'Site Administrator', 'description' => ''], ['name' => 'company_admin', 'display_name' => 'Company Administrator', 'description' => ''], ['name' => 'lead_router_admin', 'display_name' => 'LeadRouter Admin', 'description' => ''], ['name' => 'manager', 'display_name' => 'Office Manager', 'description' => ''], ['name' => 'recruiter', 'display_name' => 'LeadRouter Admin', 'description' => '']];
     $permissions = [['name' => 'can_view_dashboard', 'display_name' => 'View Admin Dashboard', 'description' => 'User can view the admin dashboard'], ['name' => 'can_access_leadrouter', 'display_name' => 'Access LeadRouter', 'description' => 'Full Access to LeadRouter'], ['name' => 'can_access_recruiting', 'display_name' => 'Access Recruiting', 'description' => 'Full access to recruiting'], ['name' => 'can_access_reporting', 'display_name' => 'Can Access Reporting', 'description' => ''], ['name' => 'can_send_text', 'display_name' => 'Can Send Text Message', 'description' => ''], ['name' => 'can_manage_users', 'display_name' => 'Can Manage Users', 'description' => 'This is user can change user permissions and add/delete users.']];
     foreach ($roles as $role) {
         \App\C21\Users\Acl\Role::create($role);
     }
     foreach ($permissions as $permission) {
         \App\C21\Users\Acl\Permission::create($permission);
     }
     $admin = \App\C21\Users\Acl\Role::where('id', 1)->first();
     $admin->attachPermissions(array(1, 2, 3, 4, 5, 6));
     $manager = \App\C21\Users\Acl\Role::where('id', 4)->first();
     $manager->attachPermissions(array(3));
     $lead_Router = \App\C21\Users\Acl\Role::where('id', 3)->first();
     $lead_Router->attachPermissions(array(2));
     $recruiter = \App\C21\Users\Acl\Role::where('id', 5)->first();
     $recruiter->attachPermissions(array(1, 3, 4));
     $company_admin = \App\C21\Users\Acl\Role::where('id', 2)->first();
     $company_admin->attachPermissions(array(1, 2, 3, 4, 5));
     $user = User::find(1)->first();
     $user->attachRole(1);
     $phone = new \App\C21\Helpers\PhoneFormater();
     $importer = new RecruitImporter($phone);
     $importer->import();
 }
 /**
  * Imports a file from csv and returns a collection
  *
  * Reformats a phone number
  * @param RecruitImporter $importer
  * @internal param PhoneFormater $phone
  */
 public function upload(RecruitImporter $importer)
 {
     $importer->import();
 }