public function cancel($hash = null)
    {
        if (! isset($hash)) {
            return redirect()->route('admin.posts.index');
        }

        $userHash = $this->auth_user->hash;
        if ($this->cache->has("autoSavedPost-$userHash")) {
            $this->cache->forget("autoSavedPost-$userHash");
        }

        $post = $this->post->byHash($hash);
        $post->being_edited_by = null;
        $post->save();

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

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

        return redirect()->route('admin.posts.index');
    }
public function cancel($hash = null)
    {
        if (! isset($hash)) {
            return redirect()->route('admin.posts.index');
        }

        $userHash = $this->auth_user->hash;
        if ($this->cache->has("autoSavedPost-$userHash")) {
            $this->cache->forget("autoSavedPost-$userHash");
        }

        $post = $this->post->byHash($hash);
        $post->being_edited_by = null;
        $post->save();

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

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

        return redirect()->route('admin.posts.index');
    }
public function cancel ( $ hash = null ) { if ( ! isset ( $ hash ) ) { return redirect ( ) -> route ( 'admin.posts.index' ) ; } $ userHash = $ this -> auth_user -> hash ; if ( $ this -> cache -> has ( "autoSavedPost-$userHash" ) ) { $ this -> cache -> forget ( "autoSavedPost-$userHash" ) ; } $ post = $ this -> post -> byHash ( $ hash ) ; $ post -> being_edited_by = null ; $ post -> save ( ) ; $ this -> tracert -> log ( 'posts' , $ post -> id , $ this -> auth_user -> id , 'canceled' ) ; $ message = trans ( 'blogify::notify.success' , [ 'model' => 'Post' , 'name' => $ post -> name , 'action' => 'canceled' ] ) ; session ( ) -> flash ( 'notify' , [ 'success' , $ message ] ) ; return redirect ( ) -> route ( 'admin.posts.index' ) ; }
Cancel changes in a post
and set being_edited_by
back to null

@param string $hash
@return \Illuminate\Http\RedirectResponse
Cancel changes in a post and set being_edited_by back to null