mercredi 30 décembre 2015

Laravel does not recognize trait

I'm changing AuthenticatesUsers.php to use google recaptcha in postLogin method.

Have a trait

<?php

namespace App\Traits;

use Illuminate\Support\Facades\Input;
use ReCaptcha\ReCaptcha;

trait CaptchaTrait {
    public function captchaCheck()
    {
        ...
    }
}

and my AuthenticatesUsers.php starts with

<?php

namespace Illuminate\Foundation\Auth;

use App\Traits\CaptchaTrait;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Lang;

trait AuthenticatesUsers
{
    use RedirectsUsers;
    use CaptchaTrait;
...
}

In login page, I get this error

FatalErrorException in AuthenticatesUsers.php line 13: Trait
'App\Traits\CaptchaTrait' not found

Can't understand why. In PhpStorm when importing class CaptchaTrait it automatically import App\Traits\CaptchaTrait to AuthenticatesUsers.php

What am I missing?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire