public function store(Request $request) { if ($request->hasFile('input-id')) { $file = $request->file('input-id'); $fileName = time() . '.' . $file->getClientOriginalExtension(); $file->move(base_path() . '/public/upload', $fileName); $bootPage = BootPage::findOrNew(1); $bootPage->path = '/upload/' . $fileName; $bootPage->save(); } else { $bootPage = BootPage::findOrNew(1); $bootPage->path = ''; $bootPage->save(); } return redirect()->action('Admin\\BootPageController@show'); }