Skip to content

Commit cabd489

Browse files
committed
Add relations for Product
1 parent 772d5f8 commit cabd489

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/Models/Product.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,14 @@ class Product extends Model
1010
use HasFactory;
1111

1212
protected $guarded = [];
13+
14+
public function categories()
15+
{
16+
return $this->belongsToMany(Category::class);
17+
}
18+
19+
public function orders()
20+
{
21+
return $this->belongsToMany(Order::class);
22+
}
1323
}

0 commit comments

Comments
 (0)