コード例 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request $request
  * @param \App\Models\Project      $project
  * @return Response
  */
 public function store(Request $request, Project $project)
 {
     $input = array_merge($request->all(), ['status' => null, 'message' => null, 'project_id' => $project->id, 'user_id' => $project->github_webhook_user_id, 'task' => 'deploy']);
     if ($this->deploymentForm->save($input)) {
         $deployment = $project->getLastDeployment();
         return $deployment->toJson();
     } else {
         abort(400, $this->deploymentForm->errors());
     }
 }
コード例 #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request $request
  * @param \App\Models\Project      $project
  * @return Response
  */
 public function store(Request $request, Project $project)
 {
     $input = array_merge($request->all(), ['status' => null, 'message' => null, 'project_id' => $project->id, 'user_id' => $request->user()->id]);
     if ($this->deploymentForm->save($input)) {
         $deployment = $project->getLastDeployment();
         $link = link_to_route('projects.deployments.show', "#{$deployment->number}", [$project, $deployment->number]);
         $request->session()->flash('status', "The deployment {$link} was successfully started.");
         return redirect()->route('projects.deployments.index', [$project]);
     } else {
         return redirect()->route('projects.deployments.index', [$project])->withInput()->withErrors($this->deploymentForm->errors());
     }
 }