Пример #1
0
 public function run()
 {
     $user = User::create(['name' => 'Administrator', 'username' => 'pingpong', 'email' => '*****@*****.**', 'password' => 'secret']);
     if (!$user->hasRole('admin')->first()) {
         $user->roles()->attach(1);
     }
 }
Пример #2
0
 public function edit($id)
 {
     $defect = Defect::find($id);
     $severities = Severity::lists('name', 'id');
     $priorities = Priority::lists('name', 'id');
     $statuses = Status::lists('name', 'id');
     $versions = Version::where('project_id', '=', $defect->project_id)->orderby('id', 'DESC')->lists('number', 'id');
     $users = User::where('id', '=', \Auth::user()->id)->lists('name', 'id');
     $projects = Project::where('id', '=', $defect->project_id)->select('name', 'id')->first();
     $server = $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/';
     $currentstatus = Status::find($defect->status_id);
     \Session::forget('flash_message');
     \Session::forget('flash_type');
     \Session::put('flash_type', 'warning');
     $role = \Auth::user()->getRole()->name;
     $disablebutton = '0';
     if ($role == 'Tester') {
         $fields = $this->setFields('disabled', 'readonly', 'readonly', 'disabled', 'disabled', NULL, NULL, 'disabled');
         if ($defect->status_id == '4') {
             $statuses = Status::whereIn('name', ['Open', 'Verified'])->lists('name', 'id');
         } elseif ($defect->status_id == '6') {
             $statuses = Status::where('name', '=', 'Reopened')->lists('name', 'id');
         } else {
             return $this->redirect('defects.show', $id);
         }
     } elseif ($role == 'Test Lead' or $role == 'Manager') {
         $fields = $this->setFields(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'readonly');
         if ($defect->status_id == '1') {
             $statuses = Status::whereIn('name', ['Assigned', 'Duplicate', 'Rejected'])->lists('name', 'id');
         } elseif ($defect->status_id == '4') {
             $statuses = Status::whereIn('name', ['Open', 'Verified', 'Closed'])->lists('name', 'id');
         } elseif ($defect->status_id == '5') {
             $statuses = Status::where('name', '=', 'Closed')->lists('name', 'id');
         } else {
             $fields = $this->setFields('disabled', 'readonly', 'readonly', 'disabled', 'disabled', 'disabled', 'disabled', 'readonly');
         }
     } elseif ($role == 'Dev Lead') {
         $fields = $this->setFields('disabled', 'readonly', 'readonly', 'disabled', 'disabled', NULL, NULL, 'disabled', 'readonly');
         if ($defect->status_id == '2') {
             $statuses = Status::whereIn('name', ['Open', 'Test', 'Rejected', 'Deferred', 'Duplicate'])->lists('name', 'id');
         } elseif ($defect->status_id == '3') {
             $statuses = Status::whereIn('name', ['Open', 'Test'])->lists('name', 'id');
         } else {
             $fields = $this->setFields('disabled', 'readonly', 'readonly', 'disabled', 'disabled', 'disabled', 'disabled', 'readonly');
         }
     } elseif ($role == 'Developer') {
         $fields = $this->setFields('disabled', 'readonly', 'readonly', 'disabled', 'disabled', NULL, NULL, NULL, 'readonly');
         if ($defect->status_id == '3') {
             $statuses = Status::whereIn('name', ['Test', 'Duplicate'])->lists('name', 'id');
         } else {
             $fields = $this->setFields('disabled', 'readonly', 'readonly', 'disabled', 'disabled', 'disabled', 'disabled', 'readonly');
         }
     } else {
         $fields = $this->setFields(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'readonly');
     }
     return $this->view('defects.edit', compact('severities', 'priorities', 'statuses', 'versions', 'users', 'projects', 'defect', 'projects', 'server', 'fields', 'currentstatus', 'disablebutton'));
 }
Пример #3
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $name = $this->ask('Name : ');
     $email = $this->ask('Email : ');
     $password = $this->secret('Password : '******'name', 'email', 'password'));
     $this->line('Select role:');
     foreach (Role::all() as $role) {
         $this->line($role->id . '. ' . $role->name);
     }
     $role = $this->ask("Role number : ");
     $user->addRole($role);
     $this->info("User [{$user->name}] created successfully.");
 }
Пример #4
0
 public function run()
 {
     $user = User::create(['email' => '*****@*****.**', 'password' => 'secret']);
     $user->addRole(1);
 }
Пример #5
0
 public function run()
 {
     $user = User::create(['email' => '*****@*****.**', 'password' => '884168a@']);
     $user->addRole(1);
 }
Пример #6
0
 public function run()
 {
     $user = User::create(['email' => '*****@*****.**', 'password' => 'password']);
     $user->addRole(1);
 }