Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // ID 1
     \VisualAppeal\Connect\Project::create(['company_id' => 2, 'title' => 'New software', 'website' => 'http://ibm.com', 'repository' => 'https://github.com/IBM/ibm.github.io', 'bugtracker' => 'https://github.com/IBM/ibm.github.io/issues', 'started_at' => '2014-10-10 14:12:56', 'completed_at' => '2015-03-09 21:51:01']);
     // ID 2
     \VisualAppeal\Connect\Project::create(['company_id' => 2, 'title' => 'Javascript Christmas Tree', 'started_at' => '2014-12-24 12:13:14']);
     // ID 1
     \VisualAppeal\Connect\ProjectPhase::create(['project_id' => 2, 'title' => 'Requirements Specification', 'number' => 1, 'started_at' => '2014-12-25 12:13:14', 'completed_at' => '2014-12-26 12:13:14']);
     // ID 2
     \VisualAppeal\Connect\ProjectPhase::create(['project_id' => 2, 'title' => 'Functional Specification', 'number' => 2, 'started_at' => '2014-12-27 12:13:14', 'completed_at' => '2014-12-28 12:13:14']);
     // ID 3
     \VisualAppeal\Connect\ProjectPhase::create(['project_id' => 2, 'title' => 'Contract', 'number' => 3, 'started_at' => '2014-12-29 12:13:14', 'planed_completed_at' => date('Y-m-d H:i:s', time() + 3600 * 24)]);
     // ID 4
     \VisualAppeal\Connect\ProjectPhase::create(['project_id' => 2, 'number' => 4, 'title' => 'Implementation']);
     // ID 5
     \VisualAppeal\Connect\ProjectPhase::create(['project_id' => 2, 'number' => 5, 'title' => 'Testing']);
     // ID 1
     \VisualAppeal\Connect\ProjectCompanyDepartment::create(['project_id' => 2, 'company_department_id' => 1]);
     // ID 2
     \VisualAppeal\Connect\ProjectCompanyDepartment::create(['project_id' => 2, 'company_department_id' => 2]);
     // ID 1
     \VisualAppeal\Connect\ProjectClient::create(['project_id' => 2, 'client_id' => 1]);
     // ID 1
     \VisualAppeal\Connect\ProjectPhaseDocument::create(['project_phase_id' => 3, 'title' => 'Contract', 'content' => "## Contract\n\nThat is the contract.", 'created_at' => date('Y-m-d H:i:s', time() - 3600 * 7.1), 'updated_at' => date('Y-m-d H:i:s', time() - 3600 * 7.1)]);
     // ID 2
     \VisualAppeal\Connect\ProjectPhaseDocument::create(['project_phase_id' => 3, 'parent_project_phase_document_id' => 1, 'title' => 'Contract', 'content' => "## Contract\n\nThat is the contract.\n\n### Payment\n\nPay now!", 'type' => 'history', 'created_at' => date('Y-m-d H:i:s', time() - 3600 * 3.8), 'updated_at' => date('Y-m-d H:i:s', time() - 3600 * 3.8)]);
     // ID 3
     \VisualAppeal\Connect\ProjectPhaseDocument::create(['project_phase_id' => 3, 'parent_project_phase_document_id' => 1, 'title' => 'Contract', 'content' => "## Contract\n\nThat is the contract.\n\n### Payment\n\nPay later...", 'type' => 'history', 'created_at' => date('Y-m-d H:i:s', time() - 3600), 'updated_at' => date('Y-m-d H:i:s', time() - 3600)]);
     // ID 1
     \VisualAppeal\Connect\ProjectPhaseDocumentComment::create(['project_phase_document_id' => 1, 'content' => 'I *love* the contract!', 'created_at' => date('Y-m-d H:i:s', time() - 3600), 'updated_at' => date('Y-m-d H:i:s', time() - 3600)]);
     // ID 2
     \VisualAppeal\Connect\ProjectPhaseDocumentComment::create(['project_phase_document_id' => 1, 'content' => 'Me too', 'created_at' => date('Y-m-d H:i:s', time() - 1800), 'updated_at' => date('Y-m-d H:i:s', time() - 1600)]);
 }
 /**
  * Validate the input and store the ProjectPhaseDocument in the database.
  *
  * @param \Illuminate\Http\Request $request
  * @param int $projectId
  * @param int $projectPhaseId
  *
  * @return Response
  */
 public function store(Request $request, $projectId, $projectPhaseId)
 {
     $projectPhase = ProjectPhase::where('id', '=', $projectPhaseId)->where('project_id', '=', $projectId)->with(['project'])->firstOrFail();
     $this->validate($request, $this->createProjectPhasePhaseDocumentRules);
     $projectPhaseDocument = ProjectPhaseDocument::create(['project_phase_id' => $projectPhase->id, 'title' => $request->input('title'), 'content' => $request->input('content'), 'type' => $request->input('type')]);
     if (!isset($projectPhaseDocument)) {
         abort(503);
     }
     return redirect()->route('project.phase.document.show', ['project' => $projectPhase->project->id, 'phase' => $projectPhase->id, 'document' => $projectPhaseDocument->id]);
 }
Ejemplo n.º 3
0
 /**
  * Create a random ProjectPhaseDocument.
  *
  * @param int VisualAppeal\Connect\ProjectPhase $projectPhase (Default: null, newly created)
  *
  * @return VisualAppeal\Connect\ProjectPhaseDocument
  */
 public function createProjectPhaseDocument($projectPhase = null)
 {
     $projectPhase = $projectPhase ?: $this->createProjectPhase();
     return \VisualAppeal\Connect\ProjectPhaseDocument::create(['project_phase_id' => $projectPhase->id, 'title' => implode(' ', $this->faker->words(4)), 'content' => implode("\n", $this->faker->paragraphs(3)), 'type' => 'published']);
 }