mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 00:05:29 +00:00
Update Story Model
This commit is contained in:
parent
d7d1303a63
commit
353b8fd856
1 changed files with 8 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App;
|
namespace App;
|
||||||
|
|
||||||
|
use Auth;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class Story extends Model
|
class Story extends Model
|
||||||
|
@ -27,4 +28,10 @@ class Story extends Model
|
||||||
{
|
{
|
||||||
return $this->hasMany(StoryView::class);
|
return $this->hasMany(StoryView::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function seen($pid = false)
|
||||||
|
{
|
||||||
|
$id = $pid ?? Auth::user()->profile->id;
|
||||||
|
return $this->views()->whereProfileId($id)->exists();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue