本文整理汇总了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);
}