MCPcopy Index your code
hub / github.com/Blogify/Blogify / cancel

Method cancel

src/Controllers/Admin/PostsController.php:311–334  ·  view source on GitHub ↗

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

($hash = null)

Source from the content-addressed store, hash-verified

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

Callers 12

aFunction · 0.80
mFunction · 0.80
yFunction · 0.80
lFunction · 0.80
cFunction · 0.80
jFunction · 0.80
fFunction · 0.80
ckeditor.jsFile · 0.80
FFunction · 0.80
QFunction · 0.80
IFunction · 0.80
JFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected