|
|
@ -8,4 +8,24 @@ use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Tag extends Model
|
|
|
|
class Tag extends Model
|
|
|
|
{
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* The decks that belong to the Tag
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function decks(): BelongsToMany
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return $this->belongsToMany(Deck::class, 'decks_tags', 'decks_id', 'tags_id');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* The Cards that belong to the Tag
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function cards(): BelongsToMany
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return $this->belongsToMany(Card::class, 'cards_tags', 'cards_id', 'tags_id');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|