<?phpnamespaceIlluminate\Encryption;useIlluminate\Support\Str;useIlluminate\Support\ServiceProvider;classEncryptionServiceProviderextendsServiceProvider{/** * Register the service provider. * * @return void */publicfunctionregister(){$this->app->singleton('encrypter',function($app){$config=$app->make('config')->get('app');// If the key starts with "base64:", we will need to decode the key before handing// it off to the encrypter. Keys may be base-64 encoded for presentation and we// want to make sure to convert them back to the raw bytes before encrypting.if(Str::startsWith($key=$config['key'],'base64:')){$key=base64_decode(substr($key,7));}returnnewEncrypter($key,$config['cipher']);});}}