greggilbert / recaptcha

[ABANDONED] reCAPTCHA Validator for Laravel 5
MIT License
714 stars 197 forks source link

Form::captcha gives Form Class not found #21

Closed ammine007 closed 10 years ago

ammine007 commented 10 years ago

I've just downloaded your package, followed what to do line by line; with laravel 4.1

But once I add {{ Form::captcha() }} it just gives me this fatal error Symfony \ Component \ Debug \ Exception \ FatalErrorException Class ' Form' not found

please is this package comptabile with Laravel 4.1 ? if yes how can I solve this problem and use your package ?

Thank you very much

greggilbert commented 10 years ago

Do you have the aliases set up properly? In that case, it sounds like the Form facade hasn't been loaded.

ammine007 commented 10 years ago

Thank you very much for your reply, But nothing has been mentioned concerning the Aliasess (in the README.md file)

What I've done . Add the following line to the require section of composer.json: { "require": { "greggilbert/recaptcha": "dev-master" } }

Add Greggilbert\Recaptcha\RecaptchaServiceProvider to the service provider list in app/config/app.php. Run php artisan config:publish greggilbert/recaptcha. In app/config/packages/greggilbert/recaptcha/config.php, enter your reCAPTCHA public and private keys. Add the following line into app/lang/[lang]/validation.php: "recaptcha" => 'The :attribute field is not correct.',

In your form, use Form::captcha() to echo out the markup. In your validation rules, add the following: $rules = array( // ... 'recaptcha_response_field' => 'required|recaptcha', };

What should I do, I'm a new be to Laravel, thank you very much once again

ammine007 commented 10 years ago

Thank you very much for everything; I should have done a composer dump-autoload in the vendor/package folder not the Root App folder.

May be it will help newbes! Thank you very much for your help !

ValleJulien commented 10 years ago

Hi, first, thank you for the post reCAPTCHA on laravel, i use it and it works perfectly, execpt for one thing.

I've just downloaded your package, followed what to do line by line; with laravel 4.1 like ammine007. I have no error, but the reCAPTCHA validator doesn't work correctly.

I use reCAPTCHA on a contact form (with blade template and of course a controller, so i have a contact.blade.php and a ContactController.php page on my project). I build my web form on the blade template, and i write the validator code on my controller. When i validate my web form, without filling my reCAPTCHA, i have a message error who ask me to fill the require field, but no error message for reCAPTCHA.

In fact, i have made validators for all fields, and i fill all of them execpt the reCAPTCHA (intentionally in order to have an error message just for reCAPTCHA).

Could you explain to me why my reCAPTCHA validator "'recaptcha_response_field' => 'required|recaptcha'," doesn't work? (i have already followed all your step one by one to get here).

Thank you in advance and i apologize for my bad english (i am a french developper, and a rookie on laravel).

greggilbert commented 10 years ago

Did you try ammine007's solution of running composer dump-autoload?

ValleJulien commented 10 years ago

Thank you for answer, in fact i forgot to give a name for my label (it's a web form) and i think blade didn't understand what the validator was for. I named my label and it works very well.