44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class NotificationPreference extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'email_notifications',
|
|
'sms_notifications',
|
|
'push_notifications',
|
|
'geofence_alerts',
|
|
'overspeed_alerts',
|
|
'offline_alerts',
|
|
'sos_alerts',
|
|
'maintenance_alerts',
|
|
];
|
|
|
|
protected $casts = [
|
|
'email_notifications' => 'boolean',
|
|
'sms_notifications' => 'boolean',
|
|
'push_notifications' => 'boolean',
|
|
'geofence_alerts' => 'boolean',
|
|
'overspeed_alerts' => 'boolean',
|
|
'offline_alerts' => 'boolean',
|
|
'sos_alerts' => 'boolean',
|
|
'maintenance_alerts' => 'boolean',
|
|
];
|
|
|
|
/**
|
|
* Get the user that owns these preferences
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|