Exemplo n.º 1
0
 /**
  * Index page view composer.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     // Default data
     $withData = ['systemStatus' => 'info', 'systemMessage' => trans('gitamin.service.bad'), 'favicon' => 'favicon-high-alert'];
     if (Project::notVisibilityLevel(1)->count() === 0) {
         // If all our projects are ok, do we have any non-fixed issues?
         $issues = Issue::orderBy('created_at', 'desc')->get();
         $issueCount = $issues->count();
         if ($issueCount === 0 || $issueCount >= 1 && (int) $issues->first()->visibility_level === 4) {
             $withData = ['systemStatus' => 'success', 'systemMessage' => trans('gitamin.service.good'), 'favicon' => 'favicon'];
         }
     } else {
         if (Project::whereIn('visibility_level', [2, 3])->count() > 0) {
             $withData['favicon'] = 'favicon-medium-alert';
         }
     }
     // Project & Project Team lists.
     $usedProjectTeams = Project::where('namespace_id', '>', 0)->groupBy('namespace_id')->lists('namespace_id');
     $projectTeams = ProjectNamespace::whereIn('id', $usedProjectTeams)->get();
     $unteamedProjects = Project::where('namespace_id', 0)->orderBy('created_at')->get();
     $view->with($withData)->withProjectTeams($projectTeams)->withUnteamedProjects($unteamedProjects);
 }
 /**
  * Handle the add project team command.
  *
  * @param \Gitamin\Commands\ProjectTeam\AddProjectTeamCommand $command
  *
  * @return \Gitamin\Models\ProjectTeam
  */
 public function handle(AddProjectNamespaceCommand $command)
 {
     $group = ProjectNamespace::create(['name' => $command->name, 'path' => $command->path, 'owner_id' => $command->owner_id, 'description' => $command->description, 'type' => $command->type]);
     event(new ProjectNamespaceWasAddedEvent($group));
     return $group;
 }
Exemplo n.º 3
0
 /**
  * Updates a project team.
  *
  * @param \Gitamin\Models\ProjectTeam $team
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update($namespace)
 {
     $groupData = Binput::get('group');
     $group = ProjectNamespace::where('path', '=', $namespace)->first();
     try {
         $groupData['project_namespace'] = $group;
         $groupData['owner_id'] = Auth::user()->id;
         $group = $this->dispatchFromArray(UpdateProjectNamespaceCommand::class, $groupData);
     } catch (ValidationException $e) {
         return Redirect::route('groups.group_edit', ['namespace' => $group->path])->withInput(Binput::all())->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('gitamin.groups.edit.failure')))->withErrors($e->getMessageBag());
     }
     return Redirect::route('groups.group_edit', ['namespace' => $group->path])->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('gitamin.groups.edit.success')));
 }