| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace App\Models;
- use App\Enums\NotificationRecipientEnum;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use Illuminate\Database\Eloquent\Relations\HasMany;
- use Illuminate\Database\Eloquent\SoftDeletes;
- class Notification extends Model
- {
- use SoftDeletes;
- protected $table = 'custom_notifications';
- protected $guarded = ['id'];
- protected function casts(): array
- {
- return [
- 'recipient' => NotificationRecipientEnum::class,
- ];
- }
- public function createdBy(): BelongsTo
- {
- return $this->belongsTo(User::class, 'created_by');
- }
- public function sends(): HasMany
- {
- return $this->hasMany(NotificationSend::class);
- }
- }
|