mercredi 27 avril 2016

ReCaptcha with Laravel 5 form class not found error

I'm trying to use greggilbert/recaptcha with my contact form and I'm getting Class 'Recaptcha' not found.

I added Greggilbert\Recaptcha\RecaptchaServiceProvider::class, to providers and 'Recaptcha' => Greggilbert\Recaptcha\Facades\Recaptcha::class, to aliases in app.php after requiring the package in composer.json then updating like the readme says.

Here is my contact form:

<form id="contact" method="post" class="form" role="form">

  @if(Session::has('errors'))
   <div class="alert alert-warning">
    @foreach(Session::get('errors')->all() as $error_message)
     <p></p>
    @endforeach
   </div>
  @endif

  <div class="row">
   <div class="col-xs-6 col-md-6 form-group">
    <input name="_token" type="hidden" value="{!! csrf_token() !!}" />
    <input class="form-control" id="name" name="name" placeholder="Name" type="text"autofocus="">
   </div>
   <div class="col-xs-6 col-md-6 form-group">
    <input class="form-control" id="email" name="email" placeholder="Email" type="text">
   </div>
  </div>
  <div class="row">
    <div class="col-md-12 form-group">
      <input class="form-control" id="subject" name="subject" placeholder="Subject" type="text">
    </div>
  </div>
  <textarea class="form-control" id="message" name="body" placeholder="Body" rows="5"></textarea>
  <br>
  <div class="row">
   <div class="col-xs-6 col-md-6 form-group">
     {!! Recaptcha::render() !!}
   </div>
   <div class="col-xs-6 col-md-6 form-group">
    <button class="btn btn-primary pull-right" type="submit">Submit</button>
   </div>
 </div>
</form>

Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire