26 lines
389 B
PHP
26 lines
389 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\User;
|
|
use Auth;
|
|
|
|
class Followable extends Model
|
|
{
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(user::class)->withDefault();
|
|
}
|
|
|
|
public function followable()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function scopeMine($query)
|
|
{
|
|
return $query->where('user_id', \Auth::guard('api')->id());
|
|
}
|
|
|
|
}
|