%PDF- %PDF-
Direktori : /var/www/html/hrsys/api/app/Models/ |
Current File : /var/www/html/hrsys/api/app/Models/Notification.php |
<?php namespace App\Models; use Carbon\Carbon; /** * @property integer id * @property string title * @property string message * @property boolean is_read * @property mixed read_at * @property integer user_id * @property integer model_id * @property string model_type * @property User user * @property string type */ //Stands for Paid time off class Notification extends BaseModel { const TYPE_INFO = 'INFO'; const TYPE_SUCCESS = 'SUCCESS'; const TYPE_ERROR = 'ERROR'; const TYPE_WARNING = 'WARNING'; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'title', 'message', 'is_read', 'read_at', 'model_type', 'model_id', 'type', ]; protected $guarded = [ 'user_id', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'id' => 'integer', 'title' => 'string', 'message' => 'string', 'is_read' => 'boolean', 'read_at' => 'date', 'user_id' => 'integer', 'model_id' => 'integer', 'model_type' => 'string', 'type' => 'string', ]; public function markAsRead() { $this->is_read = true; $this->read_at = Carbon::now(); $this->save(); return $this; } }