本文整理汇总了PHP中App\Http\Requests\PostRequest::get方法的典型用法代码示例。如果您正苦于以下问题:PHP PostRequest::get方法的具体用法?PHP PostRequest::get怎么用?PHP PostRequest::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Requests\PostRequest
的用法示例。
在下文中一共展示了PostRequest::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request\PostRequest $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(PostRequest $request, Post $post)
{
$this->authorize('update', $post);
$post->title = $request->get('title');
$post->text = $request->get('text');
$post->abstract = $post->getAbstract($request->get('text'));
$post->user_id = Auth::user()->id;
$post->save();
Flash::success('Post successfully updated');
return redirect('posts');
}
示例2: update
/**
* PUT admin/posts/{post}
*
* @param Post $post
* @param PostRequest $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function update(Post $post, PostRequest $request)
{
$post->update($request->all());
if ($request->has('tag_list')) {
$post->tags()->sync(Tag::findOrCreateMany($request->get('tag_list')));
}
flash()->success('The post has been updated');
return redirect('/admin/posts');
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(PostRequest $request)
{
$post = $request->all();
$archive = Archive::whereYearAndMonth(date("Y"), date("n"))->first();
if ($archive) {
$post['archive_id'] = $archive->id;
} else {
$newArchive = Archive::create(['year' => date("Y"), 'month' => date("n")]);
$post['archive_id'] = $newArchive->id;
}
$post['slug'] = str_slug($post['title']);
$post = Post::create($post);
CategoryPost::create(['category_id' => $request->get("category_id"), 'post_id' => $post->id]);
}
示例4: update
/**
* @param PostRequest $request
* @param $id
* @return \Illuminate\Http\RedirectResponse
*/
public function update(PostRequest $request, $id)
{
$post = Post::findOrFail($id);
$post->name = $request->get("name");
$post->content = $request->get("content");
$post->save();
$this->sync($post, $request->input("tags"));
return redirect()->route("posts.index")->with("message", "The post was updated");
}
示例5: modifyInput
/**
* Return the fields and values
*/
public function modifyInput(PostRequest $request)
{
return ['title' => $request->title, 'subtitle' => $request->subtitle, 'images' => $request->images, 'text' => $request->get('text'), 'preview' => $request->preview, 'meta_description' => $request->meta_description, 'meta_keywords' => $request->meta_keywords, 'enabled' => (bool) $request->enabled, 'date_from' => $request->date_from];
}