Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\CreateProjectRequest $response)
 {
     //
     $data = $response->all();
     //dd ($data);
     $projects = new \App\Project($data);
     //dd($customers);
     $projects->save();
     return redirect('admin/project');
 }
Ejemplo n.º 2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateProjectRequest $request)
 {
     // dd($request->input('description'));
     $project = Project::create(['title' => $request->input('title'), 'description' => $request->input('description'), 'category_id' => $request->input('category_id')]);
     if ($project) {
         flash()->success('Project created successfully!');
     } else {
         flash()->error('Oops! Something went wrong.');
     }
     return redirect(route('backend'));
 }
Ejemplo n.º 3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \App\Http\Request\CreateProjectRequest  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(CreateProjectRequest $request, $id)
 {
     $project = Project::findOrFail($id);
     $project->fill($request->all());
     $assignTo = $request->get('assignees', false);
     if ($assignTo !== false) {
         $project->assignees()->sync(null == $assignTo ? [] : $assignTo);
     }
     $project->save();
     return $project;
 }
 /**
  * Insert a new project
  * Return projects
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function store(CreateProjectRequest $request)
 {
     $payer_email = $request->get('payer_email');
     //Check if the email is for a new payer, rather than a previous payer of the payee.
     //If it is, add the row to the payee_payer pivot table before creating the project.
     //Todo: If it is a new payer, do the appropriate validation errors
     //todo: (different for if the new payer email field is blank vs the previous payer input)
     if ($request->get('new_payer')) {
         Payee::addPayer($payer_email);
     }
     //Create the project
     return $this->projectsRepository->createProject($payer_email, $request->get('description'), $request->get('rate'));
 }
Ejemplo n.º 5
0
 /**
  * Creates a new project using the input from the form
  *
  * @param CreateProjectRequest $request The validated request
  * @return mixed
  */
 public function create(CreateProjectRequest $request)
 {
     $newEntry = Project::create(['author' => Auth::user()->username, 'user_id' => Auth::user()->id, 'title' => $request->getTitle(), 'description' => $request->getDescription(), 'body' => $request->getBody(), 'statement_title' => 'Mission Statement', 'statement_body' => 'This is where you write about your mission statement or make it whatever you want.', 'tab_title' => 'Welcome', 'tab_body' => 'Here you can write a message or maybe the status of your project for all your members to see.']);
     $thumbnail = $request->file('thumbnail');
     $thumbnail->move(base_path() . '/public/images/projects', 'product' . $newEntry->id . '.jpg');
     //Sets banner image to a random pre-made banner
     $images = glob(base_path() . "/public/images/banners/*");
     $imagePath = base_path() . '/public/images/projects/' . 'banner' . $newEntry->id . '.jpg';
     $rand = random_int(0, count($images) - 1);
     \File::copy($images[$rand], $imagePath);
     //Add creator as a member and make admin of the project
     $newEntry->addMember(true);
     //Add creator as a follower of the project
     $newEntry->addFollower();
     return redirect('/project/' . $newEntry->title);
 }
 public function store(CreateProjectRequest $request)
 {
     if ($request->hasFile('thumb_img')) {
         $sol = '../';
         $file = $request->file('thumb_img');
         $filename = uniqid() . $file->getClientOriginalName();
         $file_path = $file->move('img/upload', $filename);
         $url_path = array();
         $url_path['link_file'] = $sol . $file_path;
         $img_linker = ImageSrc::create($url_path);
         $publish_home = $request->has('publish_home') ? true : false;
         $data['public_home'] = $publish_home;
         $data = $request->all();
         $project = Project::create($data);
         $project->img_link()->save($img_linker);
     } else {
         Project::create($request->all());
     }
     return redirect('admin/projects');
 }
Ejemplo n.º 7
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Requests\CreateProjectRequest $request)
 {
     //
     $project = \App\Project::findOrFail($id);
     $input = $request->all();
     \Session::flash('flash_message', 'project ' . $project->name . ' updated.');
     // logo file
     if (isset($input['image'])) {
         $input['logo_file_name'] = basename(\Request::file('image')->getRealPath());
         $input['logo_file_type'] = \Request::file('image')->getMimeType();
         \Request::file('image')->move('/tmp');
     }
     // update
     $project->update($input);
     return redirect('projects/' . $project->id);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(CreateProjectRequest $request)
 {
     $id = Auth::user()->id;
     //  if($request->file('contract'))
     //  {
     //      $contract = $request->file('contract');
     //      $name_contract = 'Appmm_'.time().'.'.$contract->getClientOriginalExtension();
     //      $path = public_path().'/upload/projects/contracts/';
     //      $contract->move($path,$name_contract);
     //  }
     //  if($request->file('file'))
     //  {
     //      $file = $request->file('file');
     //      $name_file = 'Appmm_'.time().'.'.$file->getClientOriginalExtension();
     //      $path = public_path().'/upload/projects/files/';
     //      $file->move($path,$name_file);
     //  }
     $projects = new Project($request->all());
     $projects->agent_id = $id;
     $projects->iduser_update = $id;
     //  $projects->file=$name_file;
     //  $projects->contract=$name_contract;
     $projects->save();
     Session::flash('message', $projects->name . '  Fue creado exitosamente');
     $role = Auth::user()->role;
     if ($role == 'developer' || $role == 'agent') {
         return redirect()->route('projectos.index');
     } elseif ($role == 'admin') {
         return redirect()->route('admin.projectos.index');
     }
     //  if($action=='save_new')
     //  {
     //
     //  }
     //    else {
     //  return redirect()->back();
     //   }
 }
Ejemplo n.º 9
0
 /**
  * Submit a completed, previously saved project.
  *
  * @param CreateProjectRequest $request
  * @param Project $project
  * @throws ProjectNameAlreadyTakenException
  * @return string
  */
 public function update(CreateProjectRequest $request, Project $project)
 {
     $existingProject = Project::where('project_name', '=', $request->get('project_name'))->first();
     if (!is_null($existingProject) && $existingProject->user_id != Auth::user()->id) {
         throw new ProjectNameAlreadyTakenException();
     }
     $projectDetails = ['project_name' => $request->get('project_name'), 'short_desc' => $request->get('short_desc'), 'full_desc' => $request->get('full_desc'), 'target_amount' => $request->get('target_amount'), 'child_name' => $request->get('child_name'), 'slug' => strtolower(preg_replace('/[\\s-]+/', '-', $request->get('project_name'))), 'application_status' => '1', 'user_id' => Auth::user()->id];
     $userDetails = ['first_name' => $request->get('first_name'), 'last_name' => $request->get('last_name'), 'email' => $request->get('email'), 'tel_number' => $request->get('tel_number'), 'street' => $request->get('street'), 'postcode' => $request->get('postcode'), 'city' => $request->get('city'), 'country' => $request->get('country')];
     $userDocuments = [$request->file('doc_1_mand') ? $request->file('doc_1_mand') : $request->get('doc1Mand'), $request->file('doc_2_mand') ? $request->file('doc_2_mand') : $request->get('doc2Mand'), $request->file('doc_3') ? $request->file('doc_3') : $request->get('doc3'), $request->file('doc_4') ? $request->file('doc_4') : $request->get('doc4'), $request->file('doc_5') ? $request->file('doc_5') : $request->get('doc5'), $request->file('doc_6') ? $request->file('doc_6') : $request->get('doc6')];
     $userImages = ['main_img' => $request->file('main_img') ? $request->file('main_img') : $request->get('mainImage'), 'img_2' => $request->file('img_2') ? $request->file('img_2') : $request->get('img2'), 'img_3' => $request->file('img_3') ? $request->file('img_3') : $request->get('img3'), 'img_4' => $request->file('img_4') ? $request->file('img_4') : $request->get('img4')];
     // Store the original project slug,
     // for the saved images, in case of user edit.
     $originalProjectSlug = $project->slug;
     // Update or fill the Project attributes.
     foreach ($projectDetails as $attribute => $value) {
         $project->{$attribute} = $value;
     }
     // Save the changes to the Project.
     $project->save();
     // Update user model.
     $user = Auth::user();
     foreach ($userDetails as $attribute => $value) {
         $user->{$attribute} = $value;
     }
     $user->save();
     // Make the image and document directories.
     $imageFolderPath = public_path("img/{$project->slug}");
     $documentFolderPath = public_path("documents/{$project->slug}");
     $this->makeImageDirectories($imageFolderPath);
     $this->makeDocumentDirectory($documentFolderPath);
     // Create new Document instances in the database.
     // Move the documents to their directory.
     $this->moveDocumentsAndSaveToDB($userDocuments, $documentFolderPath, $project->id, $originalProjectSlug);
     // Resize the images to our needs, and save them in their directories.
     $this->resizeImagesAndSaveToFolders($userImages, $project->child_name, $imageFolderPath, $originalProjectSlug);
     // Create new Image instances in the database.
     $this->saveImageInstancesToDB($userImages, $project->child_name, $project->id);
     // Mail the administrator, of a newly submitted project.
     $project = Auth::user()->project;
     Mail::queue('emails.project-submit', ['project' => $project], function ($message) {
         $message->to('*****@*****.**', 'Administrator')->subject(trans('create-project-form.email-subject'));
     });
     // Mail the user, of a successful project submission.
     Mail::queue('emails.project-submit-user', ['project' => $project, 'user' => $user], function ($message) use($user) {
         $message->to($user->email, $user->first_name . ' ' . $user->last_name)->subject(trans('project-submit-email.user-title'));
     });
     return json_encode(['status' => 'success']);
 }
Ejemplo n.º 10
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateProjectRequest $request)
 {
     //dd($request->input('users'));
     $input = Request::all();
     if ($input['target_mandays'] >= 60 or $input['budget'] >= 2000000) {
         $importance = "MAJOR";
     } else {
         $importance = "MINOR";
     }
     $id = Auth::user()->id;
     $pm = Auth::user()->name;
     Project::create(['cac' => $input['cac'], 'title' => $input['title'], 'user_id' => $id, 'pm' => $pm, 'status' => 'Not Yet Started', 'color' => 'Green', 'percent' => 0, 'target_start' => $input['target_start'], 'target_end' => $input['target_end'], 'actual_start' => '0000-00-00', 'actual_end' => '0000-00-00', 'budget' => $input['budget'], 'target_mandays' => $input['target_mandays'], 'actual_mandays' => '0', 'hardware' => $input['hardware'], 'software' => $input['software'], 'importance' => $importance, 'applicability' => $input['applicability'], 'confidentiality' => $input['confidentiality']]);
     $project = Project::all()->last();
     $project->users()->attach($request->input('users'));
     Chart::create(['project_id' => $project['id'], 'project_manager' => $project['pm']]);
     /* Upon creation of new project, checklist of deliverables are also created */
     $deliverables = [];
     $deliverables = ['Project Approval', 'Product Sign-off', 'Conceptual Solution Architecture Document', 'Risk and Issue Log', 'Project Definition Report', 'Project Repository', 'Project Kick-off Package', 'Proejct Organization Structure', 'Roles and Responsibilities', 'Project Timeline', 'Minutes of Project Kick-off Meeting', 'QM Classification Matrix', 'User Requirement Matrix', 'Business Process Re-engineering Document', 'Functional Specifications Document', 'Functional Specifications Sign-off', 'Conversion Plan', 'Solution Architecture Document (Logical)', 'Solution Architecture Document (Physical)', 'Technical Specifications Document', 'Technical Specifications Sign-off', 'Logical Technology Model', 'Physical Technology Model', 'Vendor System Delivery Sign-off', 'SCA Report', 'High Level SIT Plan', 'SIT Test Scripts and Cases', 'SIT Test Results', 'SIT Sign-off', 'SIT Test Probem Plan', 'High Level UAT Plan', 'Penetration Test', 'Performance Test', 'UAT Test Scripts and Results', 'UAT Test Results', 'UAT Sign-off', 'UAT Test Problem Form', 'Functional Specifications Document (Addendum)', 'Functional Specifications Change Request Form', 'Implementation Plan', 'System Documentation', 'High Level Live Test Plan', 'Training Plan', 'Training Materials', 'Preliminary Assessment for Load Test', 'Risk Management Sign-off', 'Data Governance Sign-off', 'IT Security Sign-off', 'Compliance Sign-off', 'Audit Sign-off', 'Minutes of Meeting (Pre-CRM)', 'Minutes of Meeting (CRM/PIM)', 'Data Validation Sign-off', 'Live Test Sign-off', 'Fact Gathering Feedback', 'Survey Questionnaire', 'PIA Report', 'Minutes of Meeting (PIAM/PMM)', 'Regulatory Clearance/Sign-off/Approval/Notification', 'Project Risk Assessment'];
     $i = 0;
     $required = [];
     if ($input['applicability'] == 'New or Replacement of IT Solution') {
         $required = ['M', 'O', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'O', 'M', 'M', 'O', 'M', 'M', 'M', 'M', 'O', 'O', 'O', 'N/A', 'M', 'M', 'M', 'M', 'O', 'M', 'O', 'O', 'M', 'M', 'M', 'O', 'O', 'O', 'M', 'M', 'O', 'O', 'O', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'O', 'O', 'M', 'M', 'M', 'M', 'O', 'O'];
     } elseif ($input['applicability'] == 'Enhancement or Application System Upgrade') {
         $required = ['M', 'O', '-', '-', '-', 'M', 'M', 'M', 'M', 'M', 'M', 'M', '-', 'O', 'M', 'M', 'O', '-', '-', 'M', 'M', 'O', 'O', 'O', 'N/A', 'M', 'M', 'M', 'M', 'O', 'M', 'O', 'O', 'M', 'M', 'M', 'O', 'O', 'O', 'M', 'M', 'O', 'O', 'O', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'O', 'O', 'O', 'O', 'O', 'M', 'O', 'O'];
     } elseif ($input['applicability'] == 'IT Infrastructure') {
         $required = ['M', '-', '-', '-', '-', 'M', 'M', 'M', 'M', 'M', 'M', 'M', '-', '-', '-', '-', '-', '-', 'M', 'M', 'M', 'O', 'O', 'O', 'N/A', 'M', 'M', 'M', 'M', 'O', 'M', 'O', 'O', 'M', 'M', 'M', 'O', '-', '-', 'M', 'M', 'O', 'O', 'O', 'M', '-', '-', 'M', '-', 'M', 'M', 'M', '-', 'O', 'O', 'O', 'O', 'M', 'O', 'O'];
     }
     foreach ($deliverables as $deliverable) {
         Deliverable::create(['project_id' => $project['id'], 'deliverable' => $deliverable, 'required' => $required[$i]]);
         $i = $i + 1;
     }
     flash()->success('Your new project has been created!');
     return redirect('/');
 }