@@ -60,25 +60,75 @@ This package was developed with simplicity in mind. It provides a fluent interfa
6060
6161It is plug-and-play, and does not require any additional configuration.
6262
63+ Here is the example of a controller that uses the package:
64+
6365``` php
64- use Signifly\LaravelStruct\Api\Product\Product;
66+ use Signifly\LaravelStruct\Api\Product\Product as StructProduct;
67+
68+ ...
6569
6670// Get all products
6771public function index()
6872{
69- return Product ::all(limit: 100);
73+ return StructProduct ::all(limit: 100);
7074}
7175
7276// Get a single product
7377public function show(int $id)
7478{
75- return Product::show(id: $id);
79+ return StructProduct::show(id: $id);
80+ }
81+
82+ public function store()
83+ {
84+ return StructProduct::create(
85+ productStructureUid: Str::uuid(),
86+ variationDefinitionUid: Str::uuid(),
87+ primaryCategoryId: 1,
88+ categoryIds: ['1', '2'],
89+ values: ProductValueSchema::make(
90+ name: [
91+ ProductNameSchema::make(
92+ content: 'The best Samsung TV ever produced',
93+ ),
94+ ProductNameSchema::make(
95+ content: 'Det allerbedste TV Samsung har at byde på',
96+ code: 'da-DK',
97+ ),
98+ ProductNameSchema::make(
99+ content: 'A melhor TV Samsung já produzida',
100+ code: 'pt-BR',
101+ ),
102+ ProductNameSchema::make(
103+ content: 'La mejor TV Samsung que se ha producido',
104+ code: 'es-ES',
105+ ),
106+ ProductNameSchema::make(
107+ content: 'La migliore TV Samsung mai prodotta',
108+ code: 'it-IT',
109+ ),
110+ ProductNameSchema::make(
111+ content: 'De beste Samsung TV ooit geproduceerd',
112+ code: 'nl-NL',
113+ ),
114+ ProductNameSchema::make(
115+ content: 'La meilleure TV Samsung jamais produite',
116+ code: 'fr-FR',
117+ ),
118+ ],
119+ primaryImage: 3013,
120+ extraImage: [2566, 5155, 5664],
121+ ),
122+ );
76123}
77124```
78125
126+ \*\* Note that you can rename the package if it conflicts with an existing Laravel Model.
127+
79128# Entities
80129
81130These are the following entities available in this package:
82131
83- - Product
84- - Category
132+ - Product
133+ - Category
134+ - Languages
0 commit comments