Server IP : / Your IP : 10.244.4.16 [ Web Server : nginx/1.25.3 System : Linux escuela-portal-app-54f56585bc-kst6g 5.15.0-1084-azure #93-Ubuntu SMP Sat Mar 15 14:12:29 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.2.13 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : OFF | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /proc/789/cwd/app/vendor/laravel/framework/src/Illuminate/Notifications/ |
Upload File : |
<?php namespace Illuminate\Notifications; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; class DatabaseNotification extends Model { /** * The "type" of the primary key ID. * * @var string */ protected $keyType = 'string'; /** * Indicates if the IDs are auto-incrementing. * * @var bool */ public $incrementing = false; /** * The table associated with the model. * * @var string */ protected $table = 'notifications'; /** * The guarded attributes on the model. * * @var array */ protected $guarded = []; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'data' => 'array', 'read_at' => 'datetime', ]; /** * Get the notifiable entity that the notification belongs to. * * @return \Illuminate\Database\Eloquent\Relations\MorphTo */ public function notifiable() { return $this->morphTo(); } /** * Mark the notification as read. * * @return void */ public function markAsRead() { if (is_null($this->read_at)) { $this->forceFill(['read_at' => $this->freshTimestamp()])->save(); } } /** * Mark the notification as unread. * * @return void */ public function markAsUnread() { if (! is_null($this->read_at)) { $this->forceFill(['read_at' => null])->save(); } } /** * Determine if a notification has been read. * * @return bool */ public function read() { return $this->read_at !== null; } /** * Determine if a notification has not been read. * * @return bool */ public function unread() { return $this->read_at === null; } /** * Scope a query to only include read notifications. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeRead(Builder $query) { return $query->whereNotNull('read_at'); } /** * Scope a query to only include unread notifications. * * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ public function scopeUnread(Builder $query) { return $query->whereNull('read_at'); } /** * Create a new database notification collection instance. * * @param array $models * @return \Illuminate\Notifications\DatabaseNotificationCollection */ public function newCollection(array $models = []) { return new DatabaseNotificationCollection($models); } }