public function store(PrepareProjectRequest $request)
 {
     // Mass assignment. This should not be used to reference important
     // information such as user_id because people can enter a userID
     // using PostMan
     $ProjectsList = new ProjectsList(['requester_name' => $request->requester_name, 'requester_email' => $request->requester_email, 'requester_phone' => $request->requester_phone, 'brief_description' => $request->brief_description]);
     // When referencing User_id, Project Type - this is the best way to go.
     // You are making laravale reference users and project types that exist
     $ProjectsList->project_type()->associate(ProjectType::findOrFail($request->project_type));
     $ProjectsList->user()->associate(\Auth::user());
     $ProjectsList->save();
     return \Redirect::action('\\App\\Http\\Controllers\\PagesController@home')->with('message', 'Thanks for posting a project to Andriy! Someone will get back to you shortly!');
 }
Esempio n. 2
0
 public function showUserAddProjectForm()
 {
     $skill_categories = SkillCategories::all();
     $project_type = ProjectType::all();
     $project_duration = ProjectDuration::all();
     $project_budget = ProjectBudget::all();
     $skills = Skill::all();
     return view('addproject')->with('skill_categories', $skill_categories)->with('project_type', $project_type)->with('project_budget', $project_budget)->with('project_duration', $project_duration)->with('skills', $skills);
 }