本文整理匯總了PHP中app\Page::fill方法的典型用法代碼示例。如果您正苦於以下問題:PHP Page::fill方法的具體用法?PHP Page::fill怎麽用?PHP Page::fill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Page
的用法示例。
在下文中一共展示了Page::fill方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//dd($request->all());
$this->validate($request, ['name' => 'required', 'slug' => 'unique:pages,slug', 'body' => 'required']);
$page = new Page();
if ($request->hasFile('featured_image')) {
$featured_image = $page->uploadImage($request->featured_image);
}
$page->fill($request->all());
if (isset($featured_image)) {
$page->featured_image = $featured_image;
}
$page->save();
Session::flash('flash_message', 'Síðan var vistuð');
return redirect()->back();
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$page = new Page();
$page->fill($request->all());
$slug = Helpers::makeSlug($request->input('title_geo'), 'pages');
if ($slug == "") {
return Redirect::route('admin.index');
}
$page->slug = $slug;
$image = $request->file('image');
$fileName = "";
if ($image->isValid()) {
$path = public_path() . '/uploads/pages/';
$fileName = str_random(32) . '.' . $image->getClientOriginalExtension();
$image->move($path, $fileName);
} else {
App::abort(404);
}
$page->image = $fileName;
$page->save();
return Redirect::route('admin.pages.show');
}
示例3: update
/**
* Update the specified page in storage.
*
* @param Page $page
* @param PageRequest $request
* @return Response
*/
public function update(Page $page, PageRequest $request)
{
$page->fill($request->all());
$page->save() == true ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
return redirect(route('admin.page.index'));
}
示例4: update
public function update(PageRequest $request, Page $page)
{
if (!Entrust::can('edit_page')) {
return redirect('/dashboard')->withErrors(config('constants.NA'));
}
$data = $request->all();
$page->fill($data);
$page->page_slug = Helper::createSlug($data['page_title']);
$page->save();
Helper::updateCustomField($this->form, $page->id, $data);
$activity = 'Edit a page';
Activity::log($activity);
return redirect('/page')->withSuccess(config('constants.SAVED'));
}
示例5: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Page $page
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Page $page)
{
$request->replace(['name' => $request->get('name'), 'title' => str_slug($request->get('name')), 'body' => $request->get('body')]);
$this->validate($request, ['name' => ["required", "unique:pages,name,{$page->page_id},page_id", "max:255"], 'title' => ["required", "unique:pages,title,{$page->page_id},page_id", "max:255"], 'body' => 'required']);
$page->fill(['name' => $request->get('name'), 'title' => $request->get('title'), 'body' => $request->get('body')]);
Session::flash('success', trans('config.success'));
$page->save();
return $this->edit($page);
}