當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。