tags management

This commit is contained in:
Doar Mihai
2026-02-21 16:12:57 +02:00
parent 898bddf614
commit 76d888760c
13 changed files with 850 additions and 2 deletions
+9
View File
@@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Str;
class Product extends Model
@@ -115,6 +116,14 @@ class Product extends Model
return $this->belongsTo(Category::class);
}
/**
* Get the tags for the product.
*/
public function tags(): BelongsToMany
{
return $this->belongsToMany(Tag::class);
}
/**
* Scope a query to only include approved products.
*/