diff --git a/app/Casts/EncryptedCast.php b/app/Casts/EncryptedCast.php new file mode 100644 index 000000000000..1d41b6ce333f --- /dev/null +++ b/app/Casts/EncryptedCast.php @@ -0,0 +1,27 @@ + ! is_null($value) ? encrypt($value) : null]; + } +} diff --git a/app/Models/Company.php b/app/Models/Company.php index a0d926b86f23..0a921451711a 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -11,18 +11,19 @@ namespace App\Models; -use App\DataMapper\CompanySettings; -use App\Models\Presenters\CompanyPresenter; -use App\Services\Notification\NotificationService; use App\Utils\Ninja; +use App\Casts\EncryptedCast; use App\Utils\Traits\AppSetup; -use App\Utils\Traits\CompanySettingsSaver; use App\Utils\Traits\MakesHash; -use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Illuminate\Database\Eloquent\Relations\HasMany; -use Illuminate\Notifications\Notification; +use App\DataMapper\CompanySettings; use Illuminate\Support\Facades\Cache; use Laracasts\Presenter\PresentableTrait; +use App\Utils\Traits\CompanySettingsSaver; +use Illuminate\Notifications\Notification; +use App\Models\Presenters\CompanyPresenter; +use App\Services\Notification\NotificationService; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\BelongsTo; /** * App\Models\Company @@ -358,7 +359,7 @@ class Company extends BaseModel 'deleted_at' => 'timestamp', 'client_registration_fields' => 'array', 'tax_data' => 'object', - 'e_invoice_certificate_passphrase' => 'encrypted', + 'e_invoice_certificate_passphrase' => EncryptedCast::class, ]; protected $with = [];