mirror of
https://github.com/NyaaStudios/nyaabooru.git
synced 2025-12-10 05:42:58 +00:00
Add tag & tag group creation
This commit is contained in:
parent
f64afa649a
commit
f2950ec7eb
15 changed files with 330 additions and 22 deletions
|
|
@ -3,7 +3,10 @@
|
|||
namespace App\Models;
|
||||
|
||||
use MongoDB\Laravel\Eloquent\Model;
|
||||
use MongoDB\Laravel\Relations\BelongsTo;
|
||||
use MongoDB\Laravel\Relations\BelongsToMany;
|
||||
use MongoDB\Laravel\Relations\HasMany;
|
||||
use MongoDB\Laravel\Relations\MorphToMany;
|
||||
|
||||
class Tag extends Model
|
||||
{
|
||||
|
|
@ -13,4 +16,9 @@ class Tag extends Model
|
|||
{
|
||||
return $this->belongsToMany(Post::class);
|
||||
}
|
||||
|
||||
public function tagGroup(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(TagGroup::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
16
app/Models/TagGroup.php
Normal file
16
app/Models/TagGroup.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use MongoDB\Laravel\Eloquent\Model;
|
||||
use MongoDB\Laravel\Relations\HasMany;
|
||||
|
||||
class TagGroup extends Model
|
||||
{
|
||||
protected $fillable = ['name', 'color', 'description'];
|
||||
|
||||
public function tags(): HasMany
|
||||
{
|
||||
return $this->hasMany(Tag::class);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue