@@ -15,16 +15,16 @@ |
||
| 15 | 15 | class ProductCategory extends Entity |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * @param EntityMapperInterface<ProductCategory> $mapper |
|
| 19 | - * @return void |
|
| 20 | - */ |
|
| 18 | + * @param EntityMapperInterface<ProductCategory> $mapper |
|
| 19 | + * @return void |
|
| 20 | + */ |
|
| 21 | 21 | public static function mapEntity(EntityMapperInterface $mapper): void |
| 22 | 22 | { |
| 23 | 23 | $mapper->table('product_categories'); |
| 24 | 24 | $mapper->useTimestamp(); |
| 25 | 25 | $mapper->casts([ |
| 26 | - 'created_at' => 'date', |
|
| 27 | - 'updated_at' => '?date', |
|
| 26 | + 'created_at' => 'date', |
|
| 27 | + 'updated_at' => '?date', |
|
| 28 | 28 | ]); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -15,22 +15,22 @@ discard block |
||
| 15 | 15 | class ProductCategoryParam extends BaseParam |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * The name field |
|
| 19 | - * @var string |
|
| 20 | - */ |
|
| 18 | + * The name field |
|
| 19 | + * @var string |
|
| 20 | + */ |
|
| 21 | 21 | protected string $name; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * The description field |
|
| 25 | - * @var string|null |
|
| 26 | - */ |
|
| 24 | + * The description field |
|
| 25 | + * @var string|null |
|
| 26 | + */ |
|
| 27 | 27 | protected ?string $description = null; |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | - * @param TEntity $entity |
|
| 32 | - * @return $this |
|
| 33 | - */ |
|
| 31 | + * @param TEntity $entity |
|
| 32 | + * @return $this |
|
| 33 | + */ |
|
| 34 | 34 | public function fromEntity(Entity $entity): self |
| 35 | 35 | { |
| 36 | 36 | $this->name = $entity->name; |
@@ -40,18 +40,18 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | - * Return the name value |
|
| 44 | - * @return string |
|
| 45 | - */ |
|
| 43 | + * Return the name value |
|
| 44 | + * @return string |
|
| 45 | + */ |
|
| 46 | 46 | public function getName(): string |
| 47 | 47 | { |
| 48 | 48 | return $this->name; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Return the description value |
|
| 53 | - * @return string|null |
|
| 54 | - */ |
|
| 51 | + /** |
|
| 52 | + * Return the description value |
|
| 53 | + * @return string|null |
|
| 54 | + */ |
|
| 55 | 55 | public function getDescription(): ?string |
| 56 | 56 | { |
| 57 | 57 | return $this->description; |
@@ -59,10 +59,10 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | /** |
| 62 | - * Set the name value |
|
| 63 | - * @param string $name |
|
| 64 | - * @return $this |
|
| 65 | - */ |
|
| 62 | + * Set the name value |
|
| 63 | + * @param string $name |
|
| 64 | + * @return $this |
|
| 65 | + */ |
|
| 66 | 66 | public function setName(string $name): self |
| 67 | 67 | { |
| 68 | 68 | $this->name = $name; |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | return $this; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Set the description value |
|
| 75 | - * @param string|null $description |
|
| 76 | - * @return $this |
|
| 77 | - */ |
|
| 73 | + /** |
|
| 74 | + * Set the description value |
|
| 75 | + * @param string|null $description |
|
| 76 | + * @return $this |
|
| 77 | + */ |
|
| 78 | 78 | public function setDescription(?string $description): self |
| 79 | 79 | { |
| 80 | 80 | $this->description = $description; |
@@ -14,35 +14,35 @@ |
||
| 14 | 14 | //Action when migrate up |
| 15 | 15 | $this->create('products', function (CreateTable $table) { |
| 16 | 16 | $table->integer('id') |
| 17 | - ->autoincrement() |
|
| 18 | - ->primary(); |
|
| 17 | + ->autoincrement() |
|
| 18 | + ->primary(); |
|
| 19 | 19 | |
| 20 | 20 | $table->string('name') |
| 21 | - ->description('The product name') |
|
| 22 | - ->notNull(); |
|
| 21 | + ->description('The product name') |
|
| 22 | + ->notNull(); |
|
| 23 | 23 | |
| 24 | 24 | $table->string('description') |
| 25 | - ->description('The product description'); |
|
| 25 | + ->description('The product description'); |
|
| 26 | 26 | |
| 27 | 27 | $table->float('price') |
| 28 | - ->defaultValue(0) |
|
| 29 | - ->description('The product price') |
|
| 30 | - ->notNull(); |
|
| 28 | + ->defaultValue(0) |
|
| 29 | + ->description('The product price') |
|
| 30 | + ->notNull(); |
|
| 31 | 31 | |
| 32 | 32 | $table->float('quantity') |
| 33 | - ->defaultValue(0) |
|
| 34 | - ->description('The product quantity') |
|
| 35 | - ->notNull(); |
|
| 33 | + ->defaultValue(0) |
|
| 34 | + ->description('The product quantity') |
|
| 35 | + ->notNull(); |
|
| 36 | 36 | |
| 37 | 37 | $table->integer('product_category_id') |
| 38 | - ->description('Product category') |
|
| 39 | - ->notNull(); |
|
| 38 | + ->description('Product category') |
|
| 39 | + ->notNull(); |
|
| 40 | 40 | |
| 41 | 41 | $table->timestamps(); |
| 42 | 42 | |
| 43 | 43 | $table->foreign('product_category_id') |
| 44 | - ->references('product_categories', 'id') |
|
| 45 | - ->onDelete('NO ACTION'); |
|
| 44 | + ->references('product_categories', 'id') |
|
| 45 | + ->onDelete('NO ACTION'); |
|
| 46 | 46 | |
| 47 | 47 | $table->engine('INNODB'); |
| 48 | 48 | }); |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | class ProductRepository extends Repository |
| 17 | 17 | { |
| 18 | 18 | /** |
| 19 | - * Create new instance |
|
| 20 | - * @param EntityManager<Product> $manager |
|
| 21 | - */ |
|
| 19 | + * Create new instance |
|
| 20 | + * @param EntityManager<Product> $manager |
|
| 21 | + */ |
|
| 22 | 22 | public function __construct(EntityManager $manager) |
| 23 | 23 | { |
| 24 | 24 | parent::__construct($manager, Product::class); |
@@ -16,21 +16,21 @@ |
||
| 16 | 16 | class Product extends Entity |
| 17 | 17 | { |
| 18 | 18 | /** |
| 19 | - * @param EntityMapperInterface<Product> $mapper |
|
| 20 | - * @return void |
|
| 21 | - */ |
|
| 19 | + * @param EntityMapperInterface<Product> $mapper |
|
| 20 | + * @return void |
|
| 21 | + */ |
|
| 22 | 22 | public static function mapEntity(EntityMapperInterface $mapper): void |
| 23 | 23 | { |
| 24 | - $mapper->useTimestamp(); |
|
| 25 | - $mapper->casts([ |
|
| 24 | + $mapper->useTimestamp(); |
|
| 25 | + $mapper->casts([ |
|
| 26 | 26 | 'created_at' => 'date', |
| 27 | 27 | 'updated_at' => '?date', |
| 28 | - ]); |
|
| 28 | + ]); |
|
| 29 | 29 | |
| 30 | - $mapper->relation('category')->belongsTo(ProductCategory::class); |
|
| 30 | + $mapper->relation('category')->belongsTo(ProductCategory::class); |
|
| 31 | 31 | |
| 32 | - $mapper->filter('category', function (Query $q, $value) { |
|
| 33 | - $q->where('product_category_id')->is($value); |
|
| 34 | - }); |
|
| 32 | + $mapper->filter('category', function (Query $q, $value) { |
|
| 33 | + $q->where('product_category_id')->is($value); |
|
| 34 | + }); |
|
| 35 | 35 | } |
| 36 | 36 | } |
@@ -15,40 +15,40 @@ discard block |
||
| 15 | 15 | class ProductParam extends BaseParam |
| 16 | 16 | { |
| 17 | 17 | /** |
| 18 | - * The name field |
|
| 19 | - * @var string |
|
| 20 | - */ |
|
| 18 | + * The name field |
|
| 19 | + * @var string |
|
| 20 | + */ |
|
| 21 | 21 | protected string $name; |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | - * The description field |
|
| 25 | - * @var string|null |
|
| 26 | - */ |
|
| 24 | + * The description field |
|
| 25 | + * @var string|null |
|
| 26 | + */ |
|
| 27 | 27 | protected ?string $description = null; |
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | - * The price field |
|
| 31 | - * @var float |
|
| 32 | - */ |
|
| 30 | + * The price field |
|
| 31 | + * @var float |
|
| 32 | + */ |
|
| 33 | 33 | protected float $price = 0; |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | - * The quantity field |
|
| 37 | - * @var float |
|
| 38 | - */ |
|
| 36 | + * The quantity field |
|
| 37 | + * @var float |
|
| 38 | + */ |
|
| 39 | 39 | protected float $quantity = 0; |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | - * The category field |
|
| 43 | - * @var int |
|
| 44 | - */ |
|
| 42 | + * The category field |
|
| 43 | + * @var int |
|
| 44 | + */ |
|
| 45 | 45 | protected int $category; |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * @param TEntity $entity |
|
| 50 | - * @return $this |
|
| 51 | - */ |
|
| 49 | + * @param TEntity $entity |
|
| 50 | + * @return $this |
|
| 51 | + */ |
|
| 52 | 52 | public function fromEntity(Entity $entity): self |
| 53 | 53 | { |
| 54 | 54 | $this->name = $entity->name; |
@@ -61,45 +61,45 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * Return the name value |
|
| 65 | - * @return string |
|
| 66 | - */ |
|
| 64 | + * Return the name value |
|
| 65 | + * @return string |
|
| 66 | + */ |
|
| 67 | 67 | public function getName(): string |
| 68 | 68 | { |
| 69 | 69 | return $this->name; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Return the description value |
|
| 74 | - * @return string|null |
|
| 75 | - */ |
|
| 72 | + /** |
|
| 73 | + * Return the description value |
|
| 74 | + * @return string|null |
|
| 75 | + */ |
|
| 76 | 76 | public function getDescription(): ?string |
| 77 | 77 | { |
| 78 | 78 | return $this->description; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Return the price value |
|
| 83 | - * @return float |
|
| 84 | - */ |
|
| 81 | + /** |
|
| 82 | + * Return the price value |
|
| 83 | + * @return float |
|
| 84 | + */ |
|
| 85 | 85 | public function getPrice(): float |
| 86 | 86 | { |
| 87 | 87 | return $this->price; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * Return the quantity value |
|
| 92 | - * @return float |
|
| 93 | - */ |
|
| 90 | + /** |
|
| 91 | + * Return the quantity value |
|
| 92 | + * @return float |
|
| 93 | + */ |
|
| 94 | 94 | public function getQuantity(): float |
| 95 | 95 | { |
| 96 | 96 | return $this->quantity; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Return the category value |
|
| 101 | - * @return int |
|
| 102 | - */ |
|
| 99 | + /** |
|
| 100 | + * Return the category value |
|
| 101 | + * @return int |
|
| 102 | + */ |
|
| 103 | 103 | public function getCategory(): int |
| 104 | 104 | { |
| 105 | 105 | return $this->category; |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * Set the name value |
|
| 111 | - * @param string $name |
|
| 112 | - * @return $this |
|
| 113 | - */ |
|
| 110 | + * Set the name value |
|
| 111 | + * @param string $name |
|
| 112 | + * @return $this |
|
| 113 | + */ |
|
| 114 | 114 | public function setName(string $name): self |
| 115 | 115 | { |
| 116 | 116 | $this->name = $name; |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | return $this; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Set the description value |
|
| 123 | - * @param string|null $description |
|
| 124 | - * @return $this |
|
| 125 | - */ |
|
| 121 | + /** |
|
| 122 | + * Set the description value |
|
| 123 | + * @param string|null $description |
|
| 124 | + * @return $this |
|
| 125 | + */ |
|
| 126 | 126 | public function setDescription(?string $description): self |
| 127 | 127 | { |
| 128 | 128 | $this->description = $description; |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | return $this; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * Set the price value |
|
| 135 | - * @param float $price |
|
| 136 | - * @return $this |
|
| 137 | - */ |
|
| 133 | + /** |
|
| 134 | + * Set the price value |
|
| 135 | + * @param float $price |
|
| 136 | + * @return $this |
|
| 137 | + */ |
|
| 138 | 138 | public function setPrice(float $price): self |
| 139 | 139 | { |
| 140 | 140 | $this->price = $price; |
@@ -142,11 +142,11 @@ discard block |
||
| 142 | 142 | return $this; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * Set the quantity value |
|
| 147 | - * @param float $quantity |
|
| 148 | - * @return $this |
|
| 149 | - */ |
|
| 145 | + /** |
|
| 146 | + * Set the quantity value |
|
| 147 | + * @param float $quantity |
|
| 148 | + * @return $this |
|
| 149 | + */ |
|
| 150 | 150 | public function setQuantity(float $quantity): self |
| 151 | 151 | { |
| 152 | 152 | $this->quantity = $quantity; |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | return $this; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - /** |
|
| 158 | - * Set the category value |
|
| 159 | - * @param int $category |
|
| 160 | - * @return $this |
|
| 161 | - */ |
|
| 157 | + /** |
|
| 158 | + * Set the category value |
|
| 159 | + * @param int $category |
|
| 160 | + * @return $this |
|
| 161 | + */ |
|
| 162 | 162 | public function setCategory(int $category): self |
| 163 | 163 | { |
| 164 | 164 | $this->category = $category; |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function run(): void |
| 12 | 12 | { |
| 13 | - //Action when run the seed |
|
| 13 | + //Action when run the seed |
|
| 14 | 14 | |
| 15 | 15 | $data = [ |
| 16 | 16 | 0 => [ |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function run(): void |
| 12 | 12 | { |
| 13 | - //Action when run the seed |
|
| 13 | + //Action when run the seed |
|
| 14 | 14 | |
| 15 | 15 | $data = [ |
| 16 | 16 | 0 => [ |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | |
| 11 | 11 | public function run(): void |
| 12 | 12 | { |
| 13 | - //Action when run the seed |
|
| 13 | + //Action when run the seed |
|
| 14 | 14 | |
| 15 | 15 | $data = [ |
| 16 | 16 | 0 => [ |