pai-sklep/app/Models/Order.php
2021-12-07 12:22:46 +01:00

28 lines
617 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Order extends Model
{
use HasFactory;
use HasUUID;
public $primaryKey = "uuid";
protected $fillable = ['products'];
public function address()
{
return $this->belongsTo(Address::class, "addressId", "id");
}
public function user()
{
return $this->belongsTo(User::class, "userId", "uuid");
}
public function products()
{
return $this->belongsToMany(Product::class, "orderProduct", "orderId" ,"productId");
}
}