Example #1
0
 /**
  * Store a newly created resource in storage.
  * POST /posts/store
  *
  * @param CompanyRequest             $request
  * @param PostServiceInterface $postServic
  *
  * @return Response
  */
 public function store(PostCreateRequest $request, PostServiceInterface $postServic)
 {
     if ($postServic->createPost($request->all())) {
         return redirect('/posts')->with('success', 'Post has ben successfully created');
     } else {
         return redirect('/posts')->withErrors('This Post is already exist!');
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  PostRequest  $request
  * @return Response
  */
 public function store(PostCreateRequest $request)
 {
     $post = Auth::user()->posts()->create($request->all());
     $post->slug = str_slug($post->title, "-");
     $post->save();
     $post->tags()->attach($request->input('tag_list'));
     flash()->overlay('Your post has been successfully created!', 'Good job');
     return redirect('posts/postsAuth');
 }
Example #3
0
 /**
  * Update the specified resource in storage.
  *
  * @param  PostCreateRequest $request
  * @param  int $id
  * @return Response
  */
 public function update(PostCreateRequest $request, $id)
 {
     $this->post->find($id)->update($request->all());
     return redirect()->route('admin.posts.index');
 }