Initial Commit; base feats

This commit is contained in:
Didier Slof 2022-11-23 09:32:34 +01:00
commit 9732135e90
Signed by: didier
GPG key ID: 01E71F18AA4398E5
137 changed files with 13856 additions and 0 deletions

46
app/Models/Order.php Normal file
View file

@ -0,0 +1,46 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Order extends Model
{
// An order has many tickets, can have two addresses, and belongs to a user
protected $table = 'orders';
protected $primaryKey = 'order_id';
protected $fillable = [
'user_id',
'order_number',
'order_status',
'billing_address_id',
];
protected $hidden = [
'created_at',
'updated_at',
];
public function user()
{
return $this->belongsTo(User::class, 'user_id', 'user_id');
}
public function billingAddress()
{
return $this->belongsTo(Address::class, 'billing_address_id', 'address_id');
}
public function shippingAddress()
{
return $this->belongsTo(Address::class, 'shipping_address_id', 'address_id');
}
public function tickets()
{
return $this->hasMany(Ticket::class, 'order_id', 'order_id');
}
}