* Cancel changes in a post * and set being_edited_by * back to null * * @param string $hash * @return \Illuminate\Http\RedirectResponse */
($hash = null)
| 309 | * @return \Illuminate\Http\RedirectResponse |
| 310 | */ |
| 311 | public function cancel($hash = null) |
| 312 | { |
| 313 | if (! isset($hash)) { |
| 314 | return redirect()->route('admin.posts.index'); |
| 315 | } |
| 316 | |
| 317 | $userHash = $this->auth_user->hash; |
| 318 | if ($this->cache->has("autoSavedPost-$userHash")) { |
| 319 | $this->cache->forget("autoSavedPost-$userHash"); |
| 320 | } |
| 321 | |
| 322 | $post = $this->post->byHash($hash); |
| 323 | $post->being_edited_by = null; |
| 324 | $post->save(); |
| 325 | |
| 326 | $this->tracert->log('posts', $post->id, $this->auth_user->id, 'canceled'); |
| 327 | |
| 328 | $message = trans('blogify::notify.success', [ |
| 329 | 'model' => 'Post', 'name' => $post->name, 'action' =>'canceled' |
| 330 | ]); |
| 331 | session()->flash('notify', ['success', $message]); |
| 332 | |
| 333 | return redirect()->route('admin.posts.index'); |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * @param string $hash |