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


PHP Requests\PostRequest类代码示例

本文整理汇总了PHP中App\Http\Requests\PostRequest的典型用法代码示例。如果您正苦于以下问题:PHP PostRequest类的具体用法?PHP PostRequest怎么用?PHP PostRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PostRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(PostRequest $request)
 {
     $Article = Auth::user()->posts()->create($request->all());
     $Article->tags()->attach($request->input('tag_list'));
     Session::flash('success', 'El articulo se creo correctamente!');
     return back();
 }
开发者ID:Carlos-Stgo,项目名称:Apppromo,代码行数:13,代码来源:PostController.php

示例2: Ostore

 public function Ostore($id, PostRequest $request)
 {
     $post = new Post($request->all());
     $organization = Organization::findOrFail($id);
     $organization->posts()->save($post);
     return redirect('/home/posts');
 }
开发者ID:RyOberfelder,项目名称:ccard,代码行数:7,代码来源:PostsController.php

示例3: update

 public function update(PostRequest $request, $id)
 {
     $this->post->find($id)->update($request->all());
     $post = $this->post->find($id);
     $post->tags()->sync($this->getTagsIds($request->tags));
     return redirect()->route('admin.posts.index');
 }
开发者ID:ricardovicente,项目名称:laravel-express,代码行数:7,代码来源:PostAdminController.php

示例4: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(PostRequest $request, $id)
 {
     //dd($request->except('_token','_method'));
     $post = Post::find($id);
     $post->update($request->except('_token'));
     return redirect()->route('posts.show', $post);
 }
开发者ID:MENG-WEI-LUN,项目名称:controller,代码行数:14,代码来源:postController.php

示例5: update

 public function update(PostRequest $request, $id)
 {
     $post = \App\Post::findOrFail($id);
     $post->update($request->all());
     $post->tags()->sync($request->input('tag_list'));
     return redirect('admin/post');
 }
开发者ID:KirillVladimirov,项目名称:usefulcode.ru-laravel,代码行数:7,代码来源:PostController.php

示例6: store

 public function store(PostRequest $request)
 {
     if (Input::has('link')) {
         $input['link'] = Input::get('link');
         $info = Embed::create($input['link']);
         if ($info->image == null) {
             $embed_data = ['text' => $info->description];
         } else {
             if ($info->description == null) {
                 $embed_data = ['text' => ''];
             } else {
                 $orig = pathinfo($info->image, PATHINFO_EXTENSION);
                 $qmark = str_contains($orig, '?');
                 if ($qmark == false) {
                     $extension = $orig;
                 } else {
                     $extension = substr($orig, 0, strpos($orig, '?'));
                 }
                 $newName = public_path() . '/images/' . str_random(8) . ".{$extension}";
                 if (File::exists($newName)) {
                     $imageToken = substr(sha1(mt_rand()), 0, 5);
                     $newName = public_path() . '/images/' . str_random(8) . '-' . $imageToken . ".{$extension}";
                 }
                 $image = Image::make($info->image)->fit(70, 70)->save($newName);
                 $embed_data = ['text' => $info->description, 'image' => basename($newName)];
             }
         }
         Auth::user()->posts()->create(array_merge($request->all(), $embed_data));
         return redirect('/subreddit');
     }
     Auth::user()->posts()->create($request->all());
     return redirect('/subreddit');
 }
开发者ID:ReyRodriguez,项目名称:laravel-reddit,代码行数:33,代码来源:PostsController.php

示例7: atualizar

 public function atualizar($id, PostRequest $request)
 {
     $tags_ids = $this->tagIDs($request->tags);
     $this->post->find($id)->update($request->all());
     $post = $this->post->find($id);
     $post->tags()->sync($tags_ids);
     return redirect()->route('admin.posts.index');
 }
开发者ID:rpc1910,项目名称:LaravelBlog,代码行数:8,代码来源:PostsAdminController.php

示例8: store

 /**
  * Store new post
  *
  * @param PostRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(PostRequest $request)
 {
     $post = new Post($request->all());
     $post['published_at'] = Carbon::now(new DateTimeZone(config('app.timezone')));
     $this->user->profile->posts()->save($post);
     flash()->success('Success', 'Your post has been created!');
     return redirect()->route('profiles.show', ['profiles' => $this->user->profile->id]);
 }
开发者ID:productionEA,项目名称:pockeyt-api,代码行数:14,代码来源:PostsController.php

示例9: store

 /**
  * Store new post.
  *
  * @return \Illuminate\Http\Response
  */
 public function store(PostRequest $request)
 {
     $newpost = $this->postService->create($request->all());
     if (!$newpost) {
         return redirect('/')->withErrors();
     }
     $data = ['post' => $newpost];
     return view('posts.post', $data)->render();
 }
开发者ID:TorchSK,项目名称:woofyard,代码行数:14,代码来源:PostController.php

示例10: 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

示例11: store

 public function store(PostRequest $request, TagRepository $tagRepository)
 {
     $inputs = array_merge($request->all(), ['user_id' => $request->user()->id]);
     $post = $this->postRepository->store($inputs);
     if (isset($inputs['tags'])) {
         $tagRepository->store($post, $inputs['tags']);
     }
     return redirect(route('post.index'));
 }
开发者ID:py1903,项目名称:My-Blog-Creator,代码行数:9,代码来源:PostController.php

示例12: store

 /**
  * Guarda la nueva publicación
  *
  * @param  PostRequest  $request -> valida los campos requeridos para crear una publicación
  * @return \Illuminate\Http\Response
  */
 public function store(PostRequest $request)
 {
     /* crea un nuevo objeto TestPostm con  la información que se ingresó en la forma */
     /* $request->all(), trae la información que se ingreso la forma */
     $newPost = new TestPost($request->all());
     /* especifica a que usuario le pertenece el nuevo posts  y lo guarda en  la tabla testposts */
     Auth::user()->posts()->save($newPost);
     /* redirige al listado de publicaciones realizados por el usuario loggueado */
     return redirect('posts');
 }
开发者ID:jazmintinajero,项目名称:plazaapp,代码行数:16,代码来源:PostController.php

示例13: update

 public function update(PostRequest $request, Post $post)
 {
     if ($post->user()->getResults() != Auth::user()) {
         return response('Unauthorized.', 401);
     }
     $post->update($request->all());
     $post->tags()->detach();
     $post->tags()->attach($request->input('tags'));
     return view('posts.show', compact('post'));
 }
开发者ID:khaled-barca,项目名称:MyTunnelVision,代码行数:10,代码来源:PostController.php

示例14: update

 public function update(PostRequest $request, $id)
 {
     $post = $this->post->find($id);
     if ($post) {
         $post->update($request->all());
         return redirect()->route('admin.posts.edit', ['id' => $post->id]);
         //return redirect('admin/posts/edit/'.$post->id);
     } else {
     }
 }
开发者ID:jardelbelisario,项目名称:laravel_blog,代码行数:10,代码来源:PostsAdminController.php

示例15: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(PostRequest $request)
 {
     $post = new Post();
     $topic_id = $request->input('topic_id');
     $post->content = $request->input('content');
     $post->user_id = $request->user()->id;
     $post->topic_id = $topic_id;
     $post->save();
     return Redirect::action('TopicController@show', array('id' => $topic_id));
 }
开发者ID:prudywsh,项目名称:tpe,代码行数:16,代码来源:PostController.php


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