diff options
author | Sam Light <samlight1994@gmail.com> | 2025-03-28 01:07:59 +0000 |
---|---|---|
committer | Sam Light <samlight1994@gmail.com> | 2025-03-28 01:07:59 +0000 |
commit | 80a183a94bd344c3ac08109019fdc7d341a57a6e (patch) | |
tree | 94430858a1a39219fe73f83b4c85e0f5cd3a0b1c /workbench/app/Models | |
parent | 1f81ce361cb454b1655d6e2a7ac031bc1e3b2ede (diff) |
Setup categories table, model and factory
Diffstat (limited to 'workbench/app/Models')
-rw-r--r-- | workbench/app/Models/Category.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/workbench/app/Models/Category.php b/workbench/app/Models/Category.php new file mode 100644 index 0000000..d1b1dcd --- /dev/null +++ b/workbench/app/Models/Category.php @@ -0,0 +1,22 @@ +<?php + +namespace Workbench\App\Models; + +use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Model; + +class Category extends Model +{ + use HasFactory; + + protected static function newFactory() + { + return \Workbench\Database\Factories\CategoryFactory::new(); + } + + public function products(): HasMany + { + return $this->hasMany(Product::class); + } +} |