本文整理汇总了PHP中app\Article::fill方法的典型用法代码示例。如果您正苦于以下问题:PHP Article::fill方法的具体用法?PHP Article::fill怎么用?PHP Article::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Article
的用法示例。
在下文中一共展示了Article::fill方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postCreate
/**
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function postCreate(Request $request)
{
$data = $request->all();
$this->article->fill($data);
$this->article->save();
return redirect()->to('articles/index');
}
示例2: store
public function store()
{
$article = new Article();
$article->fill(\Input::only(['title', 'content']));
$article->save();
return redirect('/');
}
示例3: postIndex
public function postIndex(Request $request)
{
$article = new Article();
$this->validate($request, ['title' => 'required', 'body' => 'required']);
$article->fill($request->all());
$article->save();
return redirect('admin/create');
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$article = new Article();
$article->fill($request->except('published_at'));
if ($request->get('is_published') == 'on') {
$article->published_at = date('Y-m-d H:i:s', time());
}
$article->user_id = Auth::id();
$article->save();
return redirect('/admin/articles');
}
示例5: transformArray
private function transformArray($hits)
{
$arr = [];
foreach ($hits as $item) {
$article = new Article();
$article->fill($item['_source']);
$article->getUrl();
$arr[] = $article;
}
return $arr;
}
示例6: 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, ['title' => 'required', 'slug' => 'unique:articles,slug', 'body' => 'required', 'published_at' => 'required|date', 'user_id' => 'required|integer']);
$article = new Article();
if ($request->hasFile('featured_image')) {
$featured_image = $article->uploadImage($request->featured_image);
}
$article->fill(clean($request->all()));
if (isset($featured_image)) {
$article->featured_image = $featured_image;
}
$article->save();
Session::flash('flash_message', 'Færslan var vistuð');
return redirect()->back();
}
示例7: update
/**
* Update the specified article in storage.
*
* @param Article $article
* @param ArticleRequest $request
* @return Response
*/
public function update(Article $article, ArticleRequest $request)
{
$article->fill($request->all());
$article->save() ? Flash::success(trans('admin.update.success')) : Flash::error(trans('admin.update.fail'));
return redirect(route('admin.article.index'));
}
示例8: savePost
/**
* save.
*
* @param Article $article article
* @param Request $input 输入
*/
public function savePost($article, $input)
{
$article->fill($input);
return $article->save();
}