/** * * @SWG\Api( * path="/setting/boot_page", * @SWG\Operation( * method="GET", summary="取得启动页广告", notes="返回的为相对路径,使用时请在前面加上http://120.27.199.121/feise/public", * @SWG\ResponseMessage(code=404, message="page not found") * * ) * ) */ public function index() { // $response = new BaseResponse(); $path = BootPage::select('path')->find(1); $response->Data = $path; return $response->toJson(); }
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'); }