Preview:
/**
* Controller Code
*/


// type-hint the Request parameter so we can simply reference $request
  public function store(Request $request)
  {
    $this->validate($request, [
      'name' => 'required|unique:categories'
    ]);
  }
  

/**
* View Code
*/

// I can then display error alerts in the view
@if ($errors->any())
  <div>
      <ul class="list-group">
          @foreach ($errors->all() as $error)
          <div class="alert alert-danger" role="alert">
              {{ $error }}
          </div>
          @endforeach
      </ul>
  </div>
@endif
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter