当前位置: 首页>>代码示例>>PHP>>正文


PHP PostRequest::get方法代码示例

本文整理汇总了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');
 }
开发者ID:Jimbol4,项目名称:blog,代码行数:18,代码来源:PostController.php

示例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');
 }
开发者ID:spitzgoby,项目名称:spitzgoby,代码行数:16,代码来源:PostsController.php

示例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]);
 }
开发者ID:rakeen,项目名称:creative,代码行数:19,代码来源:PostsController.php

示例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");
 }
开发者ID:essteffan,项目名称:laravel,代码行数:14,代码来源:PostController.php

示例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];
 }
开发者ID:visor86,项目名称:blogs,代码行数:7,代码来源:Post.php


注:本文中的App\Http\Requests\PostRequest::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。