mirror of https://github.com/pixelfed/pixelfed
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			38 lines
		
	
	
		
			586 B
		
	
	
	
		
			PHP
		
	
			
		
		
	
	
			38 lines
		
	
	
		
			586 B
		
	
	
	
		
			PHP
		
	
<?php
 | 
						|
 | 
						|
namespace App;
 | 
						|
 | 
						|
use Auth;
 | 
						|
use Illuminate\Database\Eloquent\Model;
 | 
						|
 | 
						|
class Story extends Model
 | 
						|
{
 | 
						|
	protected $visible = ['id'];
 | 
						|
 | 
						|
	public function profile()
 | 
						|
	{
 | 
						|
		return $this->belongsTo(Profile::class);
 | 
						|
	}
 | 
						|
 | 
						|
	public function items()
 | 
						|
	{
 | 
						|
		return $this->hasMany(StoryItem::class);
 | 
						|
	}
 | 
						|
 | 
						|
	public function reactions()
 | 
						|
	{
 | 
						|
		return $this->hasMany(StoryReaction::class);
 | 
						|
	}
 | 
						|
 | 
						|
	public function views()
 | 
						|
	{
 | 
						|
		return $this->hasMany(StoryView::class);
 | 
						|
	}
 | 
						|
 | 
						|
	public function seen($pid = false)
 | 
						|
	{
 | 
						|
		$id = $pid ?? Auth::user()->profile->id;
 | 
						|
		return $this->views()->whereProfileId($id)->exists();
 | 
						|
	}
 | 
						|
}
 |