summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Light <samlight1994@gmail.com>2026-02-10 00:21:51 +0000
committerSam Light <samlight1994@gmail.com>2026-02-10 00:21:51 +0000
commiteaf1b346cd5ad6bde03389c17b2f9df3f851ad8f (patch)
tree3a7fa9943e9da8702ffd3bff8a24ef4f2ffd28b4
parentad1c06ee1819b3512e2443d5cbe06199a0ae9bad (diff)
Model docblocks
-rw-r--r--workbench/app/Models/Category.php8
-rw-r--r--workbench/app/Models/Product.php21
2 files changed, 29 insertions, 0 deletions
diff --git a/workbench/app/Models/Category.php b/workbench/app/Models/Category.php
index 8e30c31..28b08de 100644
--- a/workbench/app/Models/Category.php
+++ b/workbench/app/Models/Category.php
@@ -5,8 +5,16 @@ namespace Workbench\App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
+use Illuminate\Support\Carbon;
use Workbench\Database\Factories\CategoryFactory;
+/**
+ * @property int $id
+ * @property string $name
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property Carbon|null $deleted_at
+ */
class Category extends Model
{
/**
diff --git a/workbench/app/Models/Product.php b/workbench/app/Models/Product.php
index a44cb03..e5e6bcb 100644
--- a/workbench/app/Models/Product.php
+++ b/workbench/app/Models/Product.php
@@ -6,8 +6,21 @@ use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
+use Illuminate\Support\Carbon;
use Workbench\Database\Factories\ProductFactory;
+/**
+ * @property int $id
+ * @property string $name
+ * @property string $description
+ * @property string $price
+ * @property int $stock
+ * @property int $category_id
+ * @property Carbon|null $created_at
+ * @property Carbon|null $updated_at
+ * @property Carbon|null $deleted_at
+ */
class Product extends Model
{
/**
@@ -42,4 +55,12 @@ class Product extends Model
{
return $this->belongsTo(Category::class);
}
+
+ /**
+ * @return BelongsToMany<Order, $this>
+ */
+ public function orders(): BelongsToMany
+ {
+ return $this->belongsToMany(Order::class)->withPivot('quantity', 'price')->withTimestamps();
+ }
}