public function update(Request $request, About $about) { $insert = $about->fill($request->input())->save(); $image = \Input::get('image'); if ($image != '') { $imagename = 'about-' . rand(11111, 99999) . '-gudperna.png'; $image = str_replace(' ', '+', $image); list($type, $image) = explode(';', $image); list(, $image) = explode(',', $image); $image = base64_decode($image); file_put_contents('upload/img/' . $imagename, $image); $about->image = $imagename; $about->save(); } if ($insert) { return 0; } else { return 1; } }