*/ use CanEncryptField, HasFactory; /** * The primary key for the model. * * @var string */ protected $primaryKey = 'name'; /** * The "type" of the primary key ID. * * @var string */ protected $keyType = 'string'; /** * Indicates if the IDs are auto-incrementing. * * @var bool */ public $incrementing = false; /** * Get the twofaccount that owns the icon. * * @return BelongsTo<\App\Models\TwoFAccount, $this> */ public function twofaccount() : BelongsTo { return $this->belongsTo(TwoFAccount::class, 'name', 'icon'); } /** * The model's attributes. * * @var array */ protected $attributes = []; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = ['created_at', 'updated_at']; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = ['name']; /** * Get content attribute * * @param string $value * @return string */ public function getContentAttribute($value) { return $this->decryptOrReturn(base64_decode($value)); } /** * Set content attribute * * @param string $value * @return void */ public function setContentAttribute($value) { // Encrypt if needed $this->attributes['content'] = $this->encryptOrReturn(base64_encode($value)); } }