Added test for model using trait

Added readme for CanBeBoughtTrait
https://github.com/Crinsane/LaravelShoppingcart/issues/427
This commit is contained in:
Patrick Henninger
2019-01-14 17:26:24 +01:00
parent 59eadb74a1
commit d9d28ef8e3
3 changed files with 85 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Gloudemans\Tests\Shoppingcart\Fixtures;
use Gloudemans\Shoppingcart\Contracts\Buyable;
class BuyableProductTrait implements Buyable
{
use \Gloudemans\Shoppingcart\CanBeBought;
/**
* @var int|string
*/
private $id;
/**
* @var string
*/
private $name;
/**
* @var float
*/
private $price;
/**
* @var float
*/
private $weight;
/**
* BuyableProduct constructor.
*
* @param int|string $id
* @param string $name
* @param float $price
*/
public function __construct($id = 1, $name = 'Item name', $price = 10.00, $weight = 0)
{
$this->id = $id;
$this->name = $name;
$this->price = $price;
$this->weight = $weight;
}
}