git commit "add favorites display with polymorphic relation"
This commit is contained in:
@@ -7,17 +7,17 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Favorite
|
||||
*
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $favoritable_type
|
||||
* @property int $favoritable_id
|
||||
* @property Carbon|null $created_at
|
||||
*
|
||||
*
|
||||
* @property User $user
|
||||
*
|
||||
* @package App\Models
|
||||
@@ -43,4 +43,9 @@ class Favorite extends Model
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
public function favoritable()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user