Lumen-framework: Class Crypt not found

Created on 8 Jan 2016  路  9Comments  路  Source: laravel/lumen-framework

In my User model I added

use Crypt;

at the top, and then created a setter like so:

public function setPasswordAttribute($value){
    $this->attributes['password'] = Crypt::encrypt($value);
}

but it always throws Fatal error: Class 'Crypt' not found.

Most helpful comment

Illuminate\Support\Facades\Crypt would be the correct class name.

All 9 comments

Illuminate\Support\Facades\Crypt would be the correct class name.

The docs fail to mention any of this

in 5.2, those are the only aliases we register.

@GrahamCampbell Thanks, looks like it's working now that I manually added it as a class alias.

I'd still recommend you don't do this and just import the actual class instead of an alias.

I personally hate aliases and think they should be removed from the core, but not everyone agrees with me. TBH, there are probably more people that disagree.

@GrahamCampbell Yeah, the real issue is the documentation for Encryption, which makes it look as though that Crypt facade is already accessible. _shrugs_

I know this is closed but the documentation is still broken, is there a way to make a PR for the docs? Because they are still broken and I think we shouldn't have to come to the closed issues of the framework to find out what's failing.

I'm happy to make the PR to fix this, either fixing the docs or adding the proper class_alias call on the application although from what I see, the first option is the preferred one.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maglor picture maglor  路  3Comments

jampack picture jampack  路  3Comments

jairobjunior picture jairobjunior  路  4Comments

zhengyuhe123 picture zhengyuhe123  路  4Comments

dunice picture dunice  路  3Comments