25 lines
487 B
PHP
25 lines
487 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
class BookmarkTag extends Model
|
|
{
|
|
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');
|
|
}
|
|
}
|