Files
LaravelShoppingcart/tests/Fixtures/BuyableProduct.php
2021-01-18 22:35:20 +01:00

71 lines
1.3 KiB
PHP

<?php
namespace Gloudemans\Tests\Shoppingcart\Fixtures;
use Gloudemans\Shoppingcart\Contracts\Buyable;
use Illuminate\Database\Eloquent\Model;
class BuyableProduct extends Model implements Buyable
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'id',
'name',
'title',
'description',
'price',
'weight',
];
protected $attributes = [
'id' => 1,
'name' => 'Item name',
'price' => 10.00,
'weight' => 0,
];
/**
* Get the identifier of the Buyable item.
*
* @return int|string
*/
public function getBuyableIdentifier($options = null)
{
return $this->id;
}
/**
* Get the description or title of the Buyable item.
*
* @return string
*/
public function getBuyableDescription($options = null)
{
return $this->name;
}
/**
* Get the price of the Buyable item.
*
* @return float
*/
public function getBuyablePrice($options = null)
{
return $this->price;
}
/**
* Get the price of the Buyable item.
*
* @return float
*/
public function getBuyableWeight($options = null)
{
return $this->weight;
}
}