Initial PHP rebuild of the app
This commit is contained in:
690 files changed
+33944
-12046
No files matched your search
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\NotificationType;
|
||||
use App\Models\Concerns\UsesStringIds;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Notification extends Model
|
||||
{
|
||||
use UsesStringIds;
|
||||
public $timestamps = false;
|
||||
protected $table = 'Notification';
|
||||
protected $fillable = ['businessId', 'recipientUserId', 'recipientCustomerId', 'type', 'appointmentId', 'loyaltyRewardId', 'subject', 'bodyText', 'deepLinkPath', 'idempotencyKey', 'readAt'];
|
||||
protected function casts(): array { return ['type' => NotificationType::class, 'readAt' => 'datetime']; }
|
||||
public function business(): BelongsTo { return $this->belongsTo(Business::class, 'businessId'); }
|
||||
public function recipientUser(): BelongsTo { return $this->belongsTo(User::class, 'recipientUserId'); }
|
||||
public function recipientCustomer(): BelongsTo { return $this->belongsTo(CustomerProfile::class, 'recipientCustomerId'); }
|
||||
public function appointment(): BelongsTo { return $this->belongsTo(Appointment::class, 'appointmentId'); }
|
||||
public function loyaltyReward(): BelongsTo { return $this->belongsTo(LoyaltyReward::class, 'loyaltyRewardId'); }
|
||||
public function deliveries(): HasMany { return $this->hasMany(NotificationDelivery::class, 'notificationId'); }
|
||||
}
|
||||
Reference in new issue
Block a user