anhskohbo / no-captcha

No CAPTCHA reCAPTCHA For Laravel.
https://packagist.org/packages/anhskohbo/no-captcha
MIT License
1.78k stars 234 forks source link

Why captcha does not exist ? #46

Closed tob47 closed 8 years ago

tob47 commented 8 years ago

ErrorException in Container.php line 734: Class captcha does not exist (View: /var/www/html/larapus/resources/views/auth/register.blade.php)

anhskohbo commented 8 years ago

Hi, could I see your auth/register.blade.php file?

And pls make sure you have NoCaptcha in service providers:

Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::class,
tob47 commented 8 years ago

auth/register.blade.php

`@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">Register</div>
                <div class="panel-body">
                    {!! Form::open(['url'=>'/register', 'class'=>'form-horizontal']) !!}
                    <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                    {!! Form::label('name', 'Nama', ['class'=>'col-md-4 control-label']) !!}
                    <div class="col-md-6">
                    {!! Form::text('name', null, ['class'=>'form-control']) !!}
                    {!! $errors->first('name', '<p class="help-block">:message</p>') !!}
                    </div>
                    </div>
                    <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                    {!! Form::label('email', 'Alamat Email', ['class'=>'col-md-4 control-label']) !!}
                    <div class="col-md-6">
                    {!! Form::email('email', null, ['class'=>'form-control']) !!}
                    {!! $errors->first('email', '<p class="help-block">:message</p>') !!}
                    </div>
                    </div>
                    <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                    {!! Form::label('password', 'Password', ['class'=>'col-md-4 control-label']) !!}
                    <div class="col-md-6">
                    {!! Form::password('password', ['class'=>'form-control']) !!}
                    {!! $errors->first('password', '<p class="help-block">:message</p>') !!}
                    </div>
                    </div>
                    <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                    {!! Form::label('password_confirmation', 'Konfirmasi Password', ['class'=>'col-md-4 control-label']) !!}
                    <div class="col-md-6">
                    {!! Form::password('password_confirmation', ['class'=>'form-control']) !!}
                    {!! $errors->first('password_confirmation', '<p class="help-block">:message</p>') !!}
                    </div> 
                    </div> 
                    <div class="form-group{{ $errors->has('g-recaptcha-response') ? ' has-error' : '' }}">
                    <div class="col-md-offset-4 col-md-6">
                    {!! app('captcha')->display() !!}
                    {!! $errors->first('g-recaptcha-response', '<p class="help-block">:message</p>') !!}
                    </div>
                    </div>
                    <div class="form-group">
                    <div class="col-md-6 col-md-offset-4">
                    <button type="submit" class="btn btn-primary">
                    <i class="fa fa-btn fa-user"></i> Daftar
                    </button>
                    </div>
                    </div>
                    {!! Form::close() !!}
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

`

And Providers in config/App.php

` 'providers' => [

    /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Auth\AuthServiceProvider::class,
    Illuminate\Broadcasting\BroadcastServiceProvider::class,
    Illuminate\Bus\BusServiceProvider::class,
    Illuminate\Cache\CacheServiceProvider::class,
    Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
    Illuminate\Cookie\CookieServiceProvider::class,
    Illuminate\Database\DatabaseServiceProvider::class,
    Illuminate\Encryption\EncryptionServiceProvider::class,
    Illuminate\Filesystem\FilesystemServiceProvider::class,
    Illuminate\Foundation\Providers\FoundationServiceProvider::class,
    Illuminate\Hashing\HashServiceProvider::class,
    Illuminate\Mail\MailServiceProvider::class,
    Illuminate\Pagination\PaginationServiceProvider::class,
    Illuminate\Pipeline\PipelineServiceProvider::class,
    Illuminate\Queue\QueueServiceProvider::class,
    Illuminate\Redis\RedisServiceProvider::class,
    Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
    Illuminate\Session\SessionServiceProvider::class,
    Illuminate\Translation\TranslationServiceProvider::class,
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    Collective\Html\HtmlServiceProvider::class,
    Zizaco\Entrust\EntrustServiceProvider::class,
    Yajra\Datatables\DatatablesServiceProvider::class,
    Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::class,

    /*
     * Application Service Providers...
     */
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,

],`
suciptoid commented 8 years ago

Have same issue, with laravel 5.3

shurizzle commented 8 years ago

php artisan config:cache

suciptoid commented 8 years ago

thanks @shurizzle, it's working.

alenzx commented 7 years ago

thanks @shurizzle ,it's working.

NinioDev commented 6 years ago

I have fixed it by simply typing: composer require anhskohbo/no-captcha And it works..

martsie commented 5 years ago

having this issue on laravel forge as well... worked fine in our docker instances and our CI including all the automated testing but as soon as it deployed to production our entire site shut down. When I try to do a composer require anhskohbo/no-captcha server runs out of memory.

hyperflux commented 5 years ago

Manually adding \Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::class to config/app.php was the only way this would work on production for me. I would like to know why it worked locally without it being explicitly added. Anybody have any insight? I could probably research the answer myself, but...

rambo666 commented 5 years ago

Place both of them together

 <label for="ReCaptcha">Recaptcha:</label>
          {!! NoCaptcha::renderJs() !!}
          {!! NoCaptcha::display() !!}``
Soroosh-N commented 4 years ago

@rambo666 Why this is happening? Your answer worked for me! Thanks!