public function store(PostRequest $request)
    {
        $this->data = objectify($request->except([
            '_token', 'newCategory', 'newTags'
        ]));

        if (! empty($this->data->tags)) {
            $this->buildTagsArray();
        }

        $post = $this->storeOrUpdatePost();

        if ($this->status->byHash($this->data->status)->name == 'Pending review') {
            $this->mailReviewer($post);
        }

        $action = ($request->hash == '') ? 'created' : 'updated';

        $this->tracert->log('posts', $post->id, $this->auth_user->id, $action);

        $message = trans('blogify::notify.success', [
            'model' => 'Post', 'name' => $post->title, 'action' => $action
        ]);
        session()->flash('notify', ['success', $message]);

        $hash = $this->auth_user->hash;
        $this->cache->forget("autoSavedPost-$hash");

        return redirect()->route('admin.posts.index');
    }
public function store(PostRequest $request)
    {
        $this->data = objectify($request->except([
            '_token', 'newCategory', 'newTags'
        ]));

        if (! empty($this->data->tags)) {
            $this->buildTagsArray();
        }

        $post = $this->storeOrUpdatePost();

        if ($this->status->byHash($this->data->status)->name == 'Pending review') {
            $this->mailReviewer($post);
        }

        $action = ($request->hash == '') ? 'created' : 'updated';

        $this->tracert->log('posts', $post->id, $this->auth_user->id, $action);

        $message = trans('blogify::notify.success', [
            'model' => 'Post', 'name' => $post->title, 'action' => $action
        ]);
        session()->flash('notify', ['success', $message]);

        $hash = $this->auth_user->hash;
        $this->cache->forget("autoSavedPost-$hash");

        return redirect()->route('admin.posts.index');
    }
public function store ( PostRequest $ request ) { $ this -> data = objectify ( $ request -> except ( [ '_token' , 'newCategory' , 'newTags' ] ) ) ; if ( ! empty ( $ this -> data -> tags ) ) { $ this -> buildTagsArray ( ) ; } $ post = $ this -> storeOrUpdatePost ( ) ; if ( $ this -> status -> byHash ( $ this -> data -> status ) -> name == 'Pending review' ) { $ this -> mailReviewer ( $ post ) ; } $ action = ( $ request -> hash == '' ) ? 'created' : 'updated' ; $ this -> tracert -> log ( 'posts' , $ post -> id , $ this -> auth_user -> id , $ action ) ; $ message = trans ( 'blogify::notify.success' , [ 'model' => 'Post' , 'name' => $ post -> title , 'action' => $ action ] ) ; session ( ) -> flash ( 'notify' , [ 'success' , $ message ] ) ; $ hash = $ this -> auth_user -> hash ; $ this -> cache -> forget ( "autoSavedPost-$hash" ) ; return redirect ( ) -> route ( 'admin.posts.index' ) ; }
Store or update a post

@param \jorenvanhocht\Blogify\Requests\PostRequest $request
@return \Illuminate\Http\RedirectResponse
Store or update a post