urlsnail/app/Models/BookmarkTag.php

23 lines
455 B
PHP
Raw Normal View History

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasOne;
2024-05-29 21:07:23 +00:00
use Illuminate\Database\Eloquent\Relations\Pivot;
2024-05-29 21:07:23 +00:00
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');
}
}