/** * Delete page (post). * * @Post("delete/{hash}", as="user.pastebin.delete") * * @param string $hash * * @return \Illuminate\Http\RedirectResponse */ public function postDelete($hash) { $pb = $this->pasteBin->whereHash($hash)->get()->first(); if (!isset($pb)) { abort(404); } if ($pb->user_id !== $this->user_id) { return redirect('user/pastebin')->with('message', 'そのメモはあなたのメモではありません。'); } $pb->delete(); return redirect('user/pastebin')->with('message', '削除しました。'); }