create models

This commit is contained in:
Russ Long 2018-12-23 09:00:22 -05:00
parent 90cebee2fa
commit 56c9a45c33
5 changed files with 124 additions and 0 deletions

31
app/Models/Bidders.php Normal file
View File

@ -0,0 +1,31 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Bidders extends Model
{
protected $table = 'bidders';
protected $fillable = [
'bidder_fname',
'bidder_lname',
'bidder_addr',
'bidder_city',
'bidder_state',
'bidder_zip',
'bidder_phone',
'bidder_email',
'bidder_assigned_number'
];
public function checkout()
{
return $this->hasMany('App\Models\Checkout', 'bidder_num', 'idbidders');
}
public function winningBids()
{
return $this->hasMany('App\Models\WinningBids', 'winning_bidder_num', 'idbidders');
}
}

28
app/Models/Checkout.php Normal file
View File

@ -0,0 +1,28 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Checkout extends Model
{
protected $table = 'checkout';
protected $fillable = [
'bidder_num',
'winnertotal',
'payment_method',
'check_number',
'cc_transaction',
'cc_amount'
];
public function bidder()
{
return $this->belongsTo('App\Models\Bidders', 'bidder_num', 'idbidders');
}
public function paymentMethod()
{
return $this->hasMany('App\Models\PaymentMethods', 'payment_method', 'pm_id');
}
}

21
app/Models/Items.php Normal file
View File

@ -0,0 +1,21 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Items extends Model
{
protected $table = 'items';
protected $fillable = [
'item_desc',
'item_min_bid',
'item_est_value',
'item_assigned_num'
];
public function winningBids()
{
return $this->belongsTo('App\Models\WinningBids', 'winning_item_num', 'iditems');
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class PaymentMethods extends Model
{
protected $table = 'payment_methods';
protected $fillable = [
'pm_name'
];
public function checkout()
{
return $this->belongsTo('App\Models\Checkout', 'payment_method', 'pm_id');
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class WinningBids extends Model
{
protected $table = 'winning_bids';
protected $fillable = [
'winning_bidder_num',
'winning_cost',
'winning_item_num'
];
public function items()
{
return $this->hasMany('App\Models\Items', 'winning_item_num', 'iditems');
}
public function bidders()
{
return $this->belongsTo('App\Models\Bidders', 'winning_bidder_num', 'idbidders');
}
}