for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Created by PhpStorm.
* User: arthur
* Date: 14.10.18
* Time: 18:34
*/
namespace Foundation\Models;
use Illuminate\Notifications\DatabaseNotificationCollection;
use Jenssegers\Mongodb\Eloquent\Model;
class MongoDatabaseNotification extends Model
{
* Indicates if the IDs are auto-incrementing.
*
* @var bool
public $incrementing = false;
* The table associated with the model.
* @var string
protected $collection = 'notifications';
* The guarded attributes on the model.
* @var array
protected $guarded = [];
* The attributes that should be cast to native types.
protected $casts = [
'data' => 'array',
'read_at' => 'datetime',
];
* Get the notifiable entity that the notification belongs to.
public function notifiable()
return $this->morphTo();
}
* Mark the notification as read.
* @return void
public function markAsRead()
if (is_null($this->read_at)) {
read_at
Foundation\Models\MongoDatabaseNotification
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.
$this->forceFill(['read_at' => $this->freshTimestamp()])->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.
public function unread()
return $this->read_at === null;
* Create a new database notification collection instance.
* @param array $models
* @return \Illuminate\Notifications\DatabaseNotificationCollection
public function newCollection(array $models = [])
return new DatabaseNotificationCollection($models);
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.