Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Model::encryptUsing() #35078

Closed
wants to merge 5 commits into from
Closed

Conversation

hivokas
Copy link
Contributor

@hivokas hivokas commented Nov 3, 2020

encrypted casts have been added to Laravel recently. While this feature is extremely useful, sometimes developers may want to use the separate key to encrypt database values. Currently, that's not possible. However, this PR introduces this ability by adding Model::encryptUsing() method that accepts encrypter instance that will be used to perform encryption-related casts.

The most typical use of this would be a similar piece of code in AppServiceProvider or in a separate service provider:

use Illuminate\Database\Eloquent\Model;
use Illuminate\Encryption\Encrypter;

$databaseEncryptionKey = config('database.encryption_key');

$encrypter = new Encrypter($databaseEncryptionKey);

Model::encryptUsing($encrypter);

@hivokas
Copy link
Contributor Author

hivokas commented Nov 3, 2020

Not sure why tests are failing. That's probably not related to my changes.

@driesvints
Copy link
Member

If think they are. See https://github.com/laravel/framework/pull/35078/checks?check_run_id=1348848700#step:9:111

Feel free to resubmit when they pass 👍

@driesvints driesvints closed this Nov 3, 2020
@hivokas
Copy link
Contributor Author

hivokas commented Nov 3, 2020

If think they are. See https://github.com/laravel/framework/pull/35078/checks?check_run_id=1348848700#step:9:111

Feel free to resubmit when they pass 👍

Sorry, my fault.

@hivokas
Copy link
Contributor Author

hivokas commented Nov 3, 2020

@driesvints these tests confused me.

image

But now I see that these tests are skipped, not failed :)

@hivokas
Copy link
Contributor Author

hivokas commented Nov 3, 2020

Reopened #35080

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants