@@ -7,8 +7,8 @@ |
||
7 | 7 | |
8 | 8 | class AdminOrdersController |
9 | 9 | { |
10 | - public function page(){ |
|
10 | + public function page() { |
|
11 | 11 | $orders = Order::all(); |
12 | - return view('mongicommerce::admin.pages.orders.orders_list',['orders' => $orders]); |
|
12 | + return view('mongicommerce::admin.pages.orders.orders_list', ['orders' => $orders]); |
|
13 | 13 | } |
14 | 14 | } |
@@ -11,21 +11,21 @@ |
||
11 | 11 | { |
12 | 12 | use HasFactory; |
13 | 13 | |
14 | - protected $dates = ["created_at","updated_at"]; |
|
14 | + protected $dates = ["created_at", "updated_at"]; |
|
15 | 15 | |
16 | - public function status(){ |
|
17 | - return $this->belongsTo(OrderStatus::class,'status_id'); |
|
16 | + public function status() { |
|
17 | + return $this->belongsTo(OrderStatus::class, 'status_id'); |
|
18 | 18 | } |
19 | 19 | |
20 | - public function typePayment(){ |
|
21 | - return $this->belongsTo(TypePayment::class,'type_payment_id'); |
|
20 | + public function typePayment() { |
|
21 | + return $this->belongsTo(TypePayment::class, 'type_payment_id'); |
|
22 | 22 | } |
23 | 23 | |
24 | - public function user(){ |
|
25 | - return $this->belongsTo(User::class,'user_id'); |
|
24 | + public function user() { |
|
25 | + return $this->belongsTo(User::class, 'user_id'); |
|
26 | 26 | } |
27 | 27 | |
28 | - public function products(){ |
|
29 | - return $this->belongsToMany(Product::class,'order_products','order_id','product_id')->withPivot('number_products'); |
|
28 | + public function products() { |
|
29 | + return $this->belongsToMany(Product::class, 'order_products', 'order_id', 'product_id')->withPivot('number_products'); |
|
30 | 30 | } |
31 | 31 | } |
@@ -29,11 +29,11 @@ |
||
29 | 29 | return $this->children_rec()->with('children'); |
30 | 30 | } |
31 | 31 | |
32 | - public function configuration_fields(){ |
|
32 | + public function configuration_fields() { |
|
33 | 33 | return $this->hasMany(ConfigurationField::class); |
34 | 34 | } |
35 | 35 | |
36 | - public function products(){ |
|
36 | + public function products() { |
|
37 | 37 | return $this->hasMany(Product::class); |
38 | 38 | } |
39 | 39 |
@@ -13,54 +13,54 @@ |
||
13 | 13 | use Mongi\Mongicommerce\Http\Controllers\shop\ShopShowVariationProductController; |
14 | 14 | use Mongi\Mongicommerce\Http\Controllers\shop\ShopSingleProductController; |
15 | 15 | |
16 | -Route::group(['middleware' => ['web']], function () { |
|
16 | +Route::group(['middleware' => ['web']], function() { |
|
17 | 17 | /***************** |
18 | 18 | *-----SHOP------* |
19 | 19 | *****************/ |
20 | 20 | |
21 | - Route::get('/shop/{id?}',[ShopController::class,'page'])->name('shop'); |
|
22 | - Route::get('/prodotto/{id}/{item_id?}',[ShopSingleProductController::class,'page'])->name('shop.single.product'); |
|
21 | + Route::get('/shop/{id?}', [ShopController::class, 'page'])->name('shop'); |
|
22 | + Route::get('/prodotto/{id}/{item_id?}', [ShopSingleProductController::class, 'page'])->name('shop.single.product'); |
|
23 | 23 | |
24 | - Route::post('/shop/get/product-information',[ShopShowVariationProductController::class,'getData'])->name('shop.get.product.information'); |
|
24 | + Route::post('/shop/get/product-information', [ShopShowVariationProductController::class, 'getData'])->name('shop.get.product.information'); |
|
25 | 25 | |
26 | 26 | |
27 | 27 | /***************** |
28 | 28 | *------GET------* |
29 | 29 | *****************/ |
30 | - Route::get('/admin/dashboard',[DashboardController::class,'page'])->name('admin.dashboard'); |
|
31 | - Route::get('/admin/categorie/',[AdminCategoryController::class,'page'])->name('admin.category.new'); |
|
32 | - Route::get('/admin/dettagli',[AdminDetailController::class,'page'])->name('admin.details'); |
|
33 | - Route::get('/admin/settings',[AdminSettingsController::class,'page'])->name('admin.settings'); |
|
30 | + Route::get('/admin/dashboard', [DashboardController::class, 'page'])->name('admin.dashboard'); |
|
31 | + Route::get('/admin/categorie/', [AdminCategoryController::class, 'page'])->name('admin.category.new'); |
|
32 | + Route::get('/admin/dettagli', [AdminDetailController::class, 'page'])->name('admin.details'); |
|
33 | + Route::get('/admin/settings', [AdminSettingsController::class, 'page'])->name('admin.settings'); |
|
34 | 34 | //products |
35 | - Route::get('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'page'])->name('admin.product.new'); |
|
36 | - Route::get('/admin/prodotti',[AdminProductsListController::class,'page'])->name('admin.product.list'); |
|
37 | - Route::get('/admin/prodotto-variante/{id_product}',[AdminNewProductVariationController::class,'page'])->name('admin.product.new.variante'); |
|
35 | + Route::get('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'page'])->name('admin.product.new'); |
|
36 | + Route::get('/admin/prodotti', [AdminProductsListController::class, 'page'])->name('admin.product.list'); |
|
37 | + Route::get('/admin/prodotto-variante/{id_product}', [AdminNewProductVariationController::class, 'page'])->name('admin.product.new.variante'); |
|
38 | 38 | //orders |
39 | - Route::get('/admin/ordini',[AdminOrdersController::class,'page'])->name('admin.orders.list'); |
|
39 | + Route::get('/admin/ordini', [AdminOrdersController::class, 'page'])->name('admin.orders.list'); |
|
40 | 40 | |
41 | 41 | |
42 | 42 | |
43 | 43 | /***************** |
44 | 44 | *-----POST------* |
45 | 45 | *****************/ |
46 | - Route::post('/admin/post/get/categories/tree',[AdminCategoryController::class,'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
47 | - Route::post('/admin/post/get/categories',[AdminCategoryController::class,'getCategories'])->name('admin.post.get.categories'); |
|
48 | - Route::post('/admin/post/create-new-category',[AdminCategoryController::class,'setNewCategory'])->name('admin.post.create.new.category'); |
|
46 | + Route::post('/admin/post/get/categories/tree', [AdminCategoryController::class, 'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
47 | + Route::post('/admin/post/get/categories', [AdminCategoryController::class, 'getCategories'])->name('admin.post.get.categories'); |
|
48 | + Route::post('/admin/post/create-new-category', [AdminCategoryController::class, 'setNewCategory'])->name('admin.post.create.new.category'); |
|
49 | 49 | |
50 | 50 | //details |
51 | - Route::post('/admin/post/create/detail',[AdminDetailController::class,'setNewDetail'])->name('admin.post.create.detail'); |
|
52 | - Route::post('/admin/post/get/details',[AdminDetailController::class,'getDetails'])->name('admin.post.get.details'); |
|
51 | + Route::post('/admin/post/create/detail', [AdminDetailController::class, 'setNewDetail'])->name('admin.post.create.detail'); |
|
52 | + Route::post('/admin/post/get/details', [AdminDetailController::class, 'getDetails'])->name('admin.post.get.details'); |
|
53 | 53 | |
54 | 54 | //configuration |
55 | - Route::post('/admin/post/create/configuration',[AdminConfigurationFieldController::class,'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
56 | - Route::post('/admin/post/get/configuration',[AdminConfigurationFieldController::class,'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
55 | + Route::post('/admin/post/create/configuration', [AdminConfigurationFieldController::class, 'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
56 | + Route::post('/admin/post/get/configuration', [AdminConfigurationFieldController::class, 'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
57 | 57 | |
58 | 58 | //product |
59 | - Route::post('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'createNewProduct'])->name('admin.post.product.new'); |
|
60 | - Route::post('/admin/prodotto/crea-variante-prodotto',[AdminNewProductVariationController::class,'createNewVariation'])->name('admin.post.product.variation.new'); |
|
59 | + Route::post('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'createNewProduct'])->name('admin.post.product.new'); |
|
60 | + Route::post('/admin/prodotto/crea-variante-prodotto', [AdminNewProductVariationController::class, 'createNewVariation'])->name('admin.post.product.variation.new'); |
|
61 | 61 | |
62 | 62 | |
63 | 63 | //refresh |
64 | - Route::get('/admin/update',[AdminUpdatePackageController::class,'update'])->name('admin.updatepackage'); |
|
64 | + Route::get('/admin/update', [AdminUpdatePackageController::class, 'update'])->name('admin.updatepackage'); |
|
65 | 65 | |
66 | 66 | }); |
@@ -13,13 +13,13 @@ |
||
13 | 13 | |
14 | 14 | class ShopSingleProductController extends Controller |
15 | 15 | { |
16 | - public function page($id,$product_item_id = null){ |
|
17 | - $product = Product::find($id); |
|
18 | - $details_fields = Template::getDetailsFields($product); |
|
19 | - if($product_item_id != null){ |
|
20 | - $product = ProductItem::find($product_item_id); |
|
21 | - } |
|
16 | + public function page($id,$product_item_id = null){ |
|
17 | + $product = Product::find($id); |
|
18 | + $details_fields = Template::getDetailsFields($product); |
|
19 | + if($product_item_id != null){ |
|
20 | + $product = ProductItem::find($product_item_id); |
|
21 | + } |
|
22 | 22 | |
23 | - return view('mongicommerce.pages.single-product',compact('product','details_fields')); |
|
24 | - } |
|
23 | + return view('mongicommerce.pages.single-product',compact('product','details_fields')); |
|
24 | + } |
|
25 | 25 | } |
@@ -13,13 +13,13 @@ |
||
13 | 13 | |
14 | 14 | class ShopSingleProductController extends Controller |
15 | 15 | { |
16 | - public function page($id,$product_item_id = null){ |
|
16 | + public function page($id, $product_item_id = null) { |
|
17 | 17 | $product = Product::find($id); |
18 | 18 | $details_fields = Template::getDetailsFields($product); |
19 | - if($product_item_id != null){ |
|
19 | + if ($product_item_id != null) { |
|
20 | 20 | $product = ProductItem::find($product_item_id); |
21 | 21 | } |
22 | 22 | |
23 | - return view('mongicommerce.pages.single-product',compact('product','details_fields')); |
|
23 | + return view('mongicommerce.pages.single-product', compact('product', 'details_fields')); |
|
24 | 24 | } |
25 | 25 | } |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | |
25 | 25 | $g = ''; |
26 | 26 | foreach ($informations as $key => $information) { |
27 | - $information = (object)$information; |
|
27 | + $information = (object) $information; |
|
28 | 28 | $product_detail_id = $information->product_detail_id; |
29 | 29 | $product_detail_value_id = $information->product_detail_value_id; |
30 | 30 | $condition = ''; |
31 | 31 | |
32 | - if(count($informations) == $key +1){ |
|
32 | + if (count($informations) == $key + 1) { |
|
33 | 33 | $condition = ''; |
34 | - }else{ |
|
34 | + } else { |
|
35 | 35 | $condition = 'or'; |
36 | 36 | } |
37 | 37 | $g .= ('(a.product_detail_id ='.$product_detail_id.' and a.product_detail_value_id ='.$product_detail_value_id.') '.$condition.''); |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | |
41 | 41 | $result = $q->first(); |
42 | 42 | |
43 | - if($result){ |
|
43 | + if ($result) { |
|
44 | 44 | $filters = $result->num_details >= count($informations); |
45 | - if($filters){ |
|
45 | + if ($filters) { |
|
46 | 46 | $product_item_id = $result->product_item_id; |
47 | 47 | |
48 | - return response()->json(route('shop.single.product',[$product_id,$product_item_id])); |
|
49 | - }else{ |
|
48 | + return response()->json(route('shop.single.product', [$product_id, $product_item_id])); |
|
49 | + } else { |
|
50 | 50 | return response()->json(false); |
51 | 51 | } |
52 | - }else{ |
|
52 | + } else { |
|
53 | 53 | return response()->json(false); |
54 | 54 | } |
55 | 55 |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | if(count($informations) == $key +1){ |
33 | 33 | $condition = ''; |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | $condition = 'or'; |
36 | 36 | } |
37 | 37 | $g .= ('(a.product_detail_id ='.$product_detail_id.' and a.product_detail_value_id ='.$product_detail_value_id.') '.$condition.''); |
@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | $product_item_id = $result->product_item_id; |
47 | 47 | |
48 | 48 | return response()->json(route('shop.single.product',[$product_id,$product_item_id])); |
49 | - }else{ |
|
49 | + } else{ |
|
50 | 50 | return response()->json(false); |
51 | 51 | } |
52 | - }else{ |
|
52 | + } else{ |
|
53 | 53 | return response()->json(false); |
54 | 54 | } |
55 | 55 |
@@ -11,14 +11,14 @@ |
||
11 | 11 | |
12 | 12 | class ShopController extends Controller |
13 | 13 | { |
14 | - public function page($category_id=null){ |
|
14 | + public function page($category_id = null) { |
|
15 | 15 | $products = Template::getProducts($category_id); |
16 | 16 | $category = Category::find($category_id); |
17 | 17 | $category_name = ''; |
18 | 18 | $category_description = ''; |
19 | - if($category){ |
|
19 | + if ($category) { |
|
20 | 20 | $category_name = $category->name; |
21 | 21 | }; |
22 | - return view('mongicommerce.pages.shop',compact('products','category_name','category_description')); |
|
22 | + return view('mongicommerce.pages.shop', compact('products', 'category_name', 'category_description')); |
|
23 | 23 | } |
24 | 24 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | |
10 | 10 | class AdminUpdatePackageController extends Controller |
11 | 11 | { |
12 | - public function update(){ |
|
12 | + public function update() { |
|
13 | 13 | #$dd = shell_exec('cd .. && composer update mongi/mongicommerce'); |
14 | 14 | $dd = shell_exec('cd .. && php artisan mongicommerce:update'); |
15 | 15 | echo '<pre>'; |
@@ -11,18 +11,18 @@ |
||
11 | 11 | { |
12 | 12 | use HasFactory; |
13 | 13 | |
14 | - protected $dates = ["created_at","updated_at"]; |
|
14 | + protected $dates = ["created_at", "updated_at"]; |
|
15 | 15 | |
16 | - public function items(){ |
|
16 | + public function items() { |
|
17 | 17 | return $this->hasMany(ProductItem::class); |
18 | 18 | } |
19 | 19 | |
20 | - public function category(){ |
|
20 | + public function category() { |
|
21 | 21 | return $this->belongsTo(Category::class); |
22 | 22 | } |
23 | 23 | |
24 | - public function details(){ |
|
25 | - return $this->hasManyThrough(ProductItemDetail::class,ProductItem::class); |
|
24 | + public function details() { |
|
25 | + return $this->hasManyThrough(ProductItemDetail::class, ProductItem::class); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 |