This repository was archived by the owner on Apr 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathEncryptionServiceProvider.php
66 lines (58 loc) · 2.03 KB
/
EncryptionServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* src/EncryptionServiceProvider.php.
*
* @author Austin Heap <me@austinheap.com>
* @version v0.2.1
*/
declare(strict_types=1);
namespace AustinHeap\Database\Encryption;
/**
* EncryptionServiceProvider.
*
* @link https://github.com/austinheap/laravel-database-encryption
* @link https://packagist.org/packages/austinheap/laravel-database-encryption
* @link https://austinheap.github.io/laravel-database-encryption/classes/AustinHeap.Database.Encryption.EncryptionServiceProvider.html
*/
class EncryptionServiceProvider extends \Illuminate\Support\ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application services.
*
* This method is called after all other service providers have
* been registered, meaning you have access to all other services
* that have been registered by the framework.
*
* @return void
*/
public function boot(): void
{
$this->publishes([__DIR__.'/../config/database-encryption.php' => config_path('database-encryption.php')]);
if (! defined('LARAVEL_DATABASE_ENCRYPTION_VERSION')) {
define('LARAVEL_DATABASE_ENCRYPTION_VERSION', EncryptionHelper::VERSION);
}
foreach (EncryptionDefaults::getHelpersDefault() as $helper) {
throw_if(! empty($helper) && ! function_exists($helper),
'The provider did not boot helper function: "'.$helper.'".');
}
}
/**
* Register the application services.
*
* @return void
*/
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/../config/database-encryption.php', 'database-encryption');
$this->app->singleton(EncryptionFacade::getFacadeAccessor(), function ($app) {
return new EncryptionHelper();
});
$this->commands([\AustinHeap\Database\Encryption\Console\Commands\MigrateEncryptionCommand::class]);
}
}