public static function submitProblem() { //exact duplicate check needed! if (!$_POST['params']['idcity'] || !$_POST['params']['idcategory'] || !$_POST['params']['iduser'] || !$_POST['params']['address']) { return \Response::json('Missing parameters'); } if (!empty($_FILES)) { $files = $_FILES; $link = self::uploadImage($files); } else { $link = -1; } if ($link == -1 || $link == -2 || $link == -3) { $link = null; } else { $link = $link['data']['link']; } $problem = array('iduser' => $_POST['params']['iduser'], 'idcity' => $_POST['params']['idcity'], 'idcategory' => $_POST['params']['idcategory'], 'address' => $_POST['params']['address'], 'url' => $link, 'text' => $_POST['params']['text'], 'votepositive' => '1', 'votenegative' => '0', 'lastactivity' => date('Y-m-d H:i:s', time()), 'created' => date('Y-m-d H:i:s', time())); $problem = Problem::create($problem); //add image deletion from imgur (imgurlink table, deletehash) if problem insert is unsuccessful return \Response::json($problem); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { Problem::create($request->all()); return redirect()->route('problem.index'); }