richard
/
cyca
Archived
1
0
Fork 0
This repository has been archived on 2024-05-04. You can view files and clone it, but cannot push or open issues or pull requests.
cyca/app/Models/FeedItemState.php

63 lines
1.7 KiB
PHP
Executable File

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class FeedItemState extends Model
{
// -------------------------------------------------------------------------
// ----| Properties |-------------------------------------------------------
// -------------------------------------------------------------------------
/**
* The attributes that are mass assignable.
*
* @var array
*/
public $fillable = [
'user_id',
'document_id',
'feed_id',
'feed_item_id',
];
// -------------------------------------------------------------------------
// ----| Relations |--------------------------------------------------------
// -------------------------------------------------------------------------
/**
* Associated groups.
*
* @return \Illuminate\Database\Eloquent\Relations\hasManyThrough
*/
public function groups()
{
return $this->hasManyThrough(Group::class, Folder::class);
}
/**
* Associated document.
*/
public function document()
{
return $this->belongsTo(Document::class);
}
// -------------------------------------------------------------------------
// ----| Scopes |-----------------------------------------------------------
// -------------------------------------------------------------------------
/**
* Scope a query to only include unread items.
*
* @param \Illuminate\Database\Eloquent\Builder $query
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeUnread($query)
{
return $query->where('is_read', false);
}
}