LoginSignup
8
3

More than 5 years have passed since last update.

[Laravel] リダイレクトしたときにエラーメッセージの表示とページ内リンクもする

Posted at
web.php内
if($users > 0) {
  return redirect()->route("company_detail", ["id" => $id, '#delete'])
          ->with('error', '削除されていない社員が存在するため、この企業は削除できません。');
}
index.blade.php
<h3 id="delete">削除操作</h3>
...
@if (session('error'))
  <p class="text-danger mt-3">
    {{ session('error') }}
  </p>
@endif
8
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
3