urlsnail/app/Models/BookmarkTag.php

23 lines
455 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;
public function parent()
{
return $this->belongsTo(Bookmark::class, 'bookmark_id');
}
public function tag(): HasOne
{
return $this->hasOne(Tag::class, 'id', 'tag_id');
}
}