/** * Add a sprint from the Project - Plan page */ public function add(SprintRequest $request) { if ($request->name && $request->project_id) { Sprint::create(['name' => $request->name, 'machine_name' => strtolower(preg_replace('/\\s+/', '', $request->name)), 'status_id' => SprintStatus::getIdByMachineName('inactive'), 'project_id' => (int) $request->project_id, 'sort_order' => (int) DB::table('sprints')->where('project_id', '=', $request->project_id)->max('sort_order') + 1]); } Session::flash('sprintadded', $request->name); return Redirect::back(); }
public function testUpdate() { $sprint1 = Sprint::create(['StartDate' => '2015-11-10', 'EndDate' => '2015-11-16', 'project_id' => '1']); ${$sprint1}->update(['StartDate' => '2015-11-17', 'EndDate' => '2015-11-25', 'project_id' => '1']); $this->assertEquals('2015-11-10', $sprint1->StartDate); $this->assertEquals('2015-11-16', $sprint1->EndDate); $this->assertEquals(1, Tache::all()->count()); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Project $project, Backlog $backlog, Request $request) { $user = JWTAuth::parseToken()->authenticate(); // $sprint = App::make('App\Sprint')->create($request->only('name','release')); $sprint = Sprint::create($request->only('name')); $project->sprints()->save($sprint); $user->sprints()->save($sprint); event(new FeedableEvent('SprintCreated', $user, $sprint, $project)); return response()->json(['status' => 'success', 'Sprint' => $sprint, 'Message' => 'Sprint created.']); }
public function add(NewSprintRequest $r, $project_id) { $this->validate($r, ['StartDate' => 'required|date', 'EndDate' => 'required|date|after:StartDate']); Sprint::create(["StartDate" => $r->input("StartDate"), "EndDate" => $r->input("EndDate"), "project_id" => $project_id]); return Redirect::action("SprintController@listSprint", [$project_id]); }