25 lines
497 B
PHP
25 lines
497 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
|
|
|
class BookmarkTag extends Pivot
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'bookmarks_tags';
|
|
|
|
public function parent()
|
|
{
|
|
return $this->belongsTo(Bookmark::class, 'bookmark_id');
|
|
}
|
|
|
|
public function tag(): HasOne
|
|
{
|
|
return $this->hasOne(Tag::class, 'id', 'tag_id');
|
|
}
|
|
}
|