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.
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.
Most helpful comment
Illuminate\Support\Facades\Cryptwould be the correct class name.