/** * @param $request * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function store(Request $request) { $this->validate($request, $this->rules); $data = $request->all(); $data['project_members'] = implode(',', $data['project_members']); Projects::create($data); Session::flash('flash_message', 'Congratulations, New project added successfully!'); return redirect('projects'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Requests\ProjectRequest $request) { $project = Projects::create($request->all()); return redirect('admin/project')->withSuccess('Project saved successfully!'); }
public function store() { if (Request::ajax()) { $inputData = Request::get('form#createProject'); parse_str($inputData, $formFields); $projectData = array('code' => $formFields['projectCode'], 'name' => $formFields['projectName'], 'version' => $formFields['projectVersion'], 'startDate' => $formFields['projectStartDate'], 'endDate' => $formFields['projectEndDate']); $rules = array('code' => 'required|min:3|alpha_num', 'name' => 'required|min:3', 'version' => 'required|min:1', 'startDate' => 'required|date', 'endDate' => 'required|date'); $validator = Validator::make($projectData, $rules); if ($validator->fails()) { return Response::json(array('fail' => true, 'errors' => withErrors($validator))); } else { Projects::create($projectData); $response = array('status' => 'success', 'msg' => 'Setting created successfully'); return Response::json($response); } } }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $input = $request->all(); Projects::create($input); return redirect('project')->with('status', 'Create successfully'); }