updated table structure for photobooth/sparkbooth settings. now there's a separate table for it. update all references and tests. also fixed the notification panel and the lightbox in the guest app.
This commit is contained in:
@@ -3,13 +3,12 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\EventJoinTokenService;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
class Event extends Model
|
||||
{
|
||||
@@ -24,17 +23,6 @@ class Event extends Model
|
||||
'is_active' => 'boolean',
|
||||
'name' => 'array',
|
||||
'description' => 'array',
|
||||
'photobooth_enabled' => 'boolean',
|
||||
'photobooth_mode' => 'string',
|
||||
'photobooth_expires_at' => 'datetime',
|
||||
'photobooth_metadata' => 'array',
|
||||
'sparkbooth_expires_at' => 'datetime',
|
||||
'sparkbooth_last_upload_at' => 'datetime',
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'photobooth_password_encrypted',
|
||||
'sparkbooth_password_encrypted',
|
||||
];
|
||||
|
||||
protected static function booted(): void
|
||||
@@ -126,6 +114,11 @@ class Event extends Model
|
||||
return $this->hasMany(EventMember::class);
|
||||
}
|
||||
|
||||
public function photoboothSetting(): HasOne
|
||||
{
|
||||
return $this->hasOne(EventPhotoboothSetting::class);
|
||||
}
|
||||
|
||||
public function guestNotifications(): HasMany
|
||||
{
|
||||
return $this->hasMany(GuestNotification::class);
|
||||
@@ -178,48 +171,4 @@ class Event extends Model
|
||||
|
||||
$this->attributes['settings'] = json_encode($value ?? []);
|
||||
}
|
||||
|
||||
public function getPhotoboothPasswordAttribute(): ?string
|
||||
{
|
||||
$encrypted = $this->attributes['photobooth_password_encrypted'] ?? null;
|
||||
|
||||
if (! $encrypted) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return Crypt::decryptString($encrypted);
|
||||
} catch (DecryptException) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function setPhotoboothPasswordAttribute(?string $value): void
|
||||
{
|
||||
$this->attributes['photobooth_password_encrypted'] = $value
|
||||
? Crypt::encryptString($value)
|
||||
: null;
|
||||
}
|
||||
|
||||
public function getSparkboothPasswordAttribute(): ?string
|
||||
{
|
||||
$encrypted = $this->attributes['sparkbooth_password_encrypted'] ?? null;
|
||||
|
||||
if (! $encrypted) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return Crypt::decryptString($encrypted);
|
||||
} catch (DecryptException) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function setSparkboothPasswordAttribute(?string $value): void
|
||||
{
|
||||
$this->attributes['sparkbooth_password_encrypted'] = $value
|
||||
? Crypt::encryptString($value)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user