|
|
|
@ -2,12 +2,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Auth;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
|
|
class Story extends Model
|
|
|
|
class Story extends Model
|
|
|
|
{
|
|
|
|
{
|
|
|
|
protected $visible = ['id'];
|
|
|
|
protected $visible = ['id'];
|
|
|
|
|
|
|
|
|
|
|
|
public function profile()
|
|
|
|
public function profile()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Profile::class);
|
|
|
|
return $this->belongsTo(Profile::class);
|
|
|
|
@ -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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|