@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | class Template |
| 17 | 17 | { |
| 18 | - public static function getStructureCategories(){ |
|
| 18 | + public static function getStructureCategories() { |
|
| 19 | 19 | |
| 20 | 20 | $categories = Category::with('children')->whereNull('parent_id')->get(); |
| 21 | 21 | $tree = []; |
| 22 | - foreach($categories as $category){ |
|
| 22 | + foreach ($categories as $category) { |
|
| 23 | 23 | $tree[] = [ |
| 24 | 24 | 'id' => $category->id, |
| 25 | 25 | 'text' => $category->name, |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | return $tree; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - private static function recursiveChildren($childrens){ |
|
| 33 | + private static function recursiveChildren($childrens) { |
|
| 34 | 34 | $childs = []; |
| 35 | - foreach ($childrens as $children){ |
|
| 35 | + foreach ($childrens as $children) { |
|
| 36 | 36 | $childs[] = [ |
| 37 | 37 | 'id' => $children->id, |
| 38 | 38 | 'text' => $children->name, |
@@ -48,34 +48,34 @@ discard block |
||
| 48 | 48 | * @param Int $id |
| 49 | 49 | * @return Product |
| 50 | 50 | */ |
| 51 | - public static function getProducts($id = null){ |
|
| 52 | - if($id === null){ |
|
| 51 | + public static function getProducts($id = null) { |
|
| 52 | + if ($id === null) { |
|
| 53 | 53 | $products = Product::all(); |
| 54 | - }else{ |
|
| 54 | + } else { |
|
| 55 | 55 | $products = Category::find($id)->products; |
| 56 | 56 | } |
| 57 | 57 | return $products; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public static function getDetailsFields(Product $product,$product_item_id){ |
|
| 60 | + public static function getDetailsFields(Product $product, $product_item_id) { |
|
| 61 | 61 | $element = '<div class="row">'; |
| 62 | 62 | |
| 63 | - foreach($product->details->groupBy('product_detail_id') as $key => $details){ |
|
| 63 | + foreach ($product->details->groupBy('product_detail_id') as $key => $details) { |
|
| 64 | 64 | |
| 65 | - $element.= self::generateDetailHtml(Detail::find($key),$details->groupBy('product_detail_value_id'),$product->id,$product_item_id); |
|
| 65 | + $element .= self::generateDetailHtml(Detail::find($key), $details->groupBy('product_detail_value_id'), $product->id, $product_item_id); |
|
| 66 | 66 | } |
| 67 | - $element.= '<p class="show_error_product" style="color: red; display: none;">Prodotto non disponibile</p>'; |
|
| 67 | + $element .= '<p class="show_error_product" style="color: red; display: none;">Prodotto non disponibile</p>'; |
|
| 68 | 68 | $element .= '</div>'; |
| 69 | 69 | return $element; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public static function generateHtmlField($type,$value,$label){ |
|
| 73 | - if($type !== 'textarea'){ |
|
| 72 | + public static function generateHtmlField($type, $value, $label) { |
|
| 73 | + if ($type !== 'textarea') { |
|
| 74 | 74 | $html = ''; |
| 75 | 75 | $html .= "<label>{$label}</label>"; |
| 76 | 76 | $html .= "<input class='form-control' type='{$type}' value='{$value}'>"; |
| 77 | 77 | return $html; |
| 78 | - }else{ |
|
| 78 | + } else { |
|
| 79 | 79 | $html = ''; |
| 80 | 80 | $html .= "<label>{$label}</label>"; |
| 81 | 81 | $html .= "<textarea class='form-control'>{$value}</textarea>"; |
@@ -83,40 +83,40 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - public static function getConfigurationFields($product_item_id){ |
|
| 87 | - $configurationFields = ProductConfigurationField::where('product_item_id',$product_item_id)->get(); |
|
| 86 | + public static function getConfigurationFields($product_item_id) { |
|
| 87 | + $configurationFields = ProductConfigurationField::where('product_item_id', $product_item_id)->get(); |
|
| 88 | 88 | $element = ''; |
| 89 | - foreach ($configurationFields as $field){ |
|
| 89 | + foreach ($configurationFields as $field) { |
|
| 90 | 90 | $element .= '<div class="row">'; |
| 91 | - $element .= self::generateHtmlField($field->field->type,$field->value,$field->field->name); |
|
| 91 | + $element .= self::generateHtmlField($field->field->type, $field->value, $field->field->name); |
|
| 92 | 92 | $element .= '</div>'; |
| 93 | 93 | } |
| 94 | 94 | return $element; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - public static function buttonCart($product_item_id){ |
|
| 97 | + public static function buttonCart($product_item_id) { |
|
| 98 | 98 | return "<button onclick='addToCart(this)' data-product_item_id='{$product_item_id}' class='btn btn-primary mt-3'>Salva nel carrello</button>"; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public static function generateDetailHtml($detail,$values,$product_id,$product_item_id){ |
|
| 101 | + public static function generateDetailHtml($detail, $values, $product_id, $product_item_id) { |
|
| 102 | 102 | |
| 103 | 103 | $type = $detail->type; |
| 104 | 104 | $html = ''; |
| 105 | - if($type === 'select'){ |
|
| 105 | + if ($type === 'select') { |
|
| 106 | 106 | $html = '<label>'.$detail->name.'</label>'; |
| 107 | - $html .= '<select onchange="getVariationProduct()" data-product_id="'.$product_id.'" data-detail_id="'.$detail->id .'" class="form-control mongifield_into_product">'; |
|
| 107 | + $html .= '<select onchange="getVariationProduct()" data-product_id="'.$product_id.'" data-detail_id="'.$detail->id.'" class="form-control mongifield_into_product">'; |
|
| 108 | 108 | $selected = ''; |
| 109 | 109 | |
| 110 | - $details = ProductItemDetail::where('product_item_id',$product_item_id)->get(); |
|
| 110 | + $details = ProductItemDetail::where('product_item_id', $product_item_id)->get(); |
|
| 111 | 111 | $filter = []; |
| 112 | - foreach ($details as $_detail){ |
|
| 112 | + foreach ($details as $_detail) { |
|
| 113 | 113 | $filter[$_detail->product_detail_id] = $_detail->product_detail_value_id; |
| 114 | 114 | } |
| 115 | - foreach ($values as $detail_value_id =>$value){ |
|
| 116 | - if(isset($filter[$detail->id])){ |
|
| 117 | - if($filter[$detail->id] == $detail_value_id){ |
|
| 115 | + foreach ($values as $detail_value_id =>$value) { |
|
| 116 | + if (isset($filter[$detail->id])) { |
|
| 117 | + if ($filter[$detail->id] == $detail_value_id) { |
|
| 118 | 118 | $selected = 'selected'; |
| 119 | - }else{ |
|
| 119 | + } else { |
|
| 120 | 120 | $selected = ''; |
| 121 | 121 | } |
| 122 | 122 | } |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | return $html; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - public static function MoveSessionToCart($user_id){ |
|
| 132 | + public static function MoveSessionToCart($user_id) { |
|
| 133 | 133 | $user = User::find($user_id); |
| 134 | 134 | $elements_in_cart = session('cart'); |
| 135 | - if(!empty($elements_in_cart)){ |
|
| 136 | - if(Cart::where('user_id',$user->id)->count() <= 0){ |
|
| 137 | - foreach($elements_in_cart as $product_id => $count){ |
|
| 135 | + if (!empty($elements_in_cart)) { |
|
| 136 | + if (Cart::where('user_id', $user->id)->count() <= 0) { |
|
| 137 | + foreach ($elements_in_cart as $product_id => $count) { |
|
| 138 | 138 | $cart = new Cart(); |
| 139 | 139 | $cart->user_id = $user->id; |
| 140 | 140 | $cart->product_item_id = $product_id; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public function boot() |
| 22 | 22 | { |
| 23 | 23 | |
| 24 | - Blade::directive('money', function ($amount){ |
|
| 24 | + Blade::directive('money', function($amount) { |
|
| 25 | 25 | #return $fmt->formatCurrency($amount,"EUR"); |
| 26 | 26 | /*return "<?= $fmt->formatCurrency($amount,'EUR'); ?>";*/ |
| 27 | 27 | return "<?= abs($amount) > 1000 ? '€ ' .number_format($amount, 0, ',', '.') : '€ ' . number_format($amount, 2, ',', '.') ?>"; |
@@ -35,12 +35,12 @@ discard block |
||
| 35 | 35 | $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
| 36 | 36 | $this->loadRoutesFrom(__DIR__.'/routes.php'); |
| 37 | 37 | |
| 38 | - if(Schema::hasTable('admin_settings')){ |
|
| 38 | + if (Schema::hasTable('admin_settings')) { |
|
| 39 | 39 | //inject global information into views |
| 40 | 40 | View::share('mongicommerce', AdminSetting::first()); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if(Schema::hasTable('categories')){ |
|
| 43 | + if (Schema::hasTable('categories')) { |
|
| 44 | 44 | //inject global information into views |
| 45 | 45 | View::share('categories', Template::getStructureCategories()); |
| 46 | 46 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | if ($this->app->runningInConsole()) { |
| 50 | 50 | |
| 51 | 51 | $config_file = config_path('mongicommerce.php'); |
| 52 | - if(file_exists($config_file)){ |
|
| 52 | + if (file_exists($config_file)) { |
|
| 53 | 53 | File::delete($config_file); |
| 54 | 54 | } |
| 55 | 55 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | __DIR__.'/../config/config.php' => config_path('mongicommerce.php'), |
| 59 | 59 | ], 'config'); |
| 60 | 60 | |
| 61 | - if(file_exists(resource_path('/views/mongicommerce'))){ |
|
| 61 | + if (file_exists(resource_path('/views/mongicommerce'))) { |
|
| 62 | 62 | File::deleteDirectory(resource_path('/views/mongicommerce')); |
| 63 | 63 | } |
| 64 | 64 | // Publishing the views. |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | __DIR__.'/../resources/views/shop' => resource_path('/views/mongicommerce'), |
| 67 | 67 | ], 'views'); |
| 68 | 68 | |
| 69 | - if(file_exists(public_path('/mongicommerce/template'))){ |
|
| 69 | + if (file_exists(public_path('/mongicommerce/template'))) { |
|
| 70 | 70 | File::deleteDirectory(public_path('/mongicommerce/template')); |
| 71 | 71 | } |
| 72 | 72 | // Publishing assets. |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'mongicommerce'); |
| 98 | 98 | |
| 99 | 99 | // Register the main class to use with the facade |
| 100 | - $this->app->singleton('mongicommerce', function () { |
|
| 100 | + $this->app->singleton('mongicommerce', function() { |
|
| 101 | 101 | return new Mongicommerce; |
| 102 | 102 | }); |
| 103 | 103 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | use Mongi\Mongicommerce\Http\Controllers\shop\ShopShowVariationProductController; |
| 27 | 27 | use Mongi\Mongicommerce\Http\Controllers\admin\AdminNewProductVariationController; |
| 28 | 28 | |
| 29 | -Route::group(['middleware' => ['web']], function () { |
|
| 29 | +Route::group(['middleware' => ['web']], function() { |
|
| 30 | 30 | /***************** |
| 31 | 31 | *-----SHOP------* |
| 32 | 32 | *****************/ |
@@ -48,27 +48,27 @@ discard block |
||
| 48 | 48 | Route::get('/page/shop/user/settings', [ShopUserController::class, 'page'])->name('shop.user.settings'); |
| 49 | 49 | |
| 50 | 50 | |
| 51 | - Route::get('/shop/{id?}',[ShopController::class,'page'])->name('shop'); |
|
| 52 | - Route::get('/prodotto/{id}/{item_id?}',[ShopSingleProductController::class,'page'])->name('shop.single.product'); |
|
| 53 | - Route::get('page/shop/cart/',[ShopCartController::class,'page'])->name('shop.cart'); |
|
| 54 | - Route::get('page/shop/summary/',[ShopSummaryController::class,'page'])->name('shop.summary'); |
|
| 55 | - Route::get('page/shop/shipment/',[ShopShipmentController::class,'page'])->name('shop.shipment'); |
|
| 56 | - Route::get('page/shop/checkout/',[ShopCheckoutController::class,'page'])->name('shop.checkout'); |
|
| 57 | - Route::get('page/shop/payment/',[ShopPaymentController::class,'page'])->name('shop.payment'); |
|
| 51 | + Route::get('/shop/{id?}', [ShopController::class, 'page'])->name('shop'); |
|
| 52 | + Route::get('/prodotto/{id}/{item_id?}', [ShopSingleProductController::class, 'page'])->name('shop.single.product'); |
|
| 53 | + Route::get('page/shop/cart/', [ShopCartController::class, 'page'])->name('shop.cart'); |
|
| 54 | + Route::get('page/shop/summary/', [ShopSummaryController::class, 'page'])->name('shop.summary'); |
|
| 55 | + Route::get('page/shop/shipment/', [ShopShipmentController::class, 'page'])->name('shop.shipment'); |
|
| 56 | + Route::get('page/shop/checkout/', [ShopCheckoutController::class, 'page'])->name('shop.checkout'); |
|
| 57 | + Route::get('page/shop/payment/', [ShopPaymentController::class, 'page'])->name('shop.payment'); |
|
| 58 | 58 | |
| 59 | 59 | |
| 60 | 60 | |
| 61 | - Route::post('/shop/get/product-information',[ShopShowVariationProductController::class,'getData'])->name('shop.get.product.information'); |
|
| 62 | - Route::post('/shop/addtocart',[ShopCartController::class,'addToCart'])->name('shop.addtocart'); |
|
| 63 | - Route::post('/shop/getcartelements',[ShopCartController::class,'getCartElements'])->name('shop.getcartelements'); |
|
| 61 | + Route::post('/shop/get/product-information', [ShopShowVariationProductController::class, 'getData'])->name('shop.get.product.information'); |
|
| 62 | + Route::post('/shop/addtocart', [ShopCartController::class, 'addToCart'])->name('shop.addtocart'); |
|
| 63 | + Route::post('/shop/getcartelements', [ShopCartController::class, 'getCartElements'])->name('shop.getcartelements'); |
|
| 64 | 64 | |
| 65 | - Route::post('/shop/getcartproducts/',[ShopCartController::class,'getCartProducts'])->name('getcartproducts'); |
|
| 66 | - Route::post('/shop/increment_number_product_in_cart/',[ShopCartController::class,'incrementOrDecrementElementInCart'])->name('increment_number_product_in_cart'); |
|
| 67 | - Route::post('/shop/delete_from_cart',[ShopCartController::class,'deleteFromCart'])->name('delete_from_cart'); |
|
| 68 | - Route::post('/shop/save_cache_details_order',[ShopCheckoutController::class,'saveDetailsInSession'])->name('save_cache_details_order'); |
|
| 69 | - Route::post('/shop/gotocheckout',[ShopShipmentController::class,'goToCheckout'])->name('shop.gotocheckout'); |
|
| 70 | - Route::post('/shop/pay',[ShopPaymentController::class,'pay'])->name('shop.pay'); |
|
| 71 | - Route::post('/shop/normalpayment',[ShopPaymentController::class,'normalPayment'])->name('shop.normalpayment'); |
|
| 65 | + Route::post('/shop/getcartproducts/', [ShopCartController::class, 'getCartProducts'])->name('getcartproducts'); |
|
| 66 | + Route::post('/shop/increment_number_product_in_cart/', [ShopCartController::class, 'incrementOrDecrementElementInCart'])->name('increment_number_product_in_cart'); |
|
| 67 | + Route::post('/shop/delete_from_cart', [ShopCartController::class, 'deleteFromCart'])->name('delete_from_cart'); |
|
| 68 | + Route::post('/shop/save_cache_details_order', [ShopCheckoutController::class, 'saveDetailsInSession'])->name('save_cache_details_order'); |
|
| 69 | + Route::post('/shop/gotocheckout', [ShopShipmentController::class, 'goToCheckout'])->name('shop.gotocheckout'); |
|
| 70 | + Route::post('/shop/pay', [ShopPaymentController::class, 'pay'])->name('shop.pay'); |
|
| 71 | + Route::post('/shop/normalpayment', [ShopPaymentController::class, 'normalPayment'])->name('shop.normalpayment'); |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | |
@@ -78,44 +78,44 @@ discard block |
||
| 78 | 78 | /***************** |
| 79 | 79 | *------GET------* |
| 80 | 80 | *****************/ |
| 81 | - Route::get('/admin/dashboard',[DashboardController::class,'page'])->name('admin.dashboard'); |
|
| 82 | - Route::get('/admin/categorie/',[AdminCategoryController::class,'page'])->name('admin.category.new'); |
|
| 83 | - Route::get('/admin/dettagli',[AdminDetailController::class,'page'])->name('admin.details'); |
|
| 84 | - Route::get('/admin/settings',[AdminSettingsController::class,'page'])->name('admin.settings'); |
|
| 81 | + Route::get('/admin/dashboard', [DashboardController::class, 'page'])->name('admin.dashboard'); |
|
| 82 | + Route::get('/admin/categorie/', [AdminCategoryController::class, 'page'])->name('admin.category.new'); |
|
| 83 | + Route::get('/admin/dettagli', [AdminDetailController::class, 'page'])->name('admin.details'); |
|
| 84 | + Route::get('/admin/settings', [AdminSettingsController::class, 'page'])->name('admin.settings'); |
|
| 85 | 85 | //products |
| 86 | - Route::get('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'page'])->name('admin.product.new'); |
|
| 87 | - Route::get('/admin/prodotti',[AdminProductsListController::class,'page'])->name('admin.product.list'); |
|
| 88 | - Route::get('/admin/prodotto/crea-singolo-prodotto',[AdminNewSingleProductController::class,'page'])->name('admin.new.single.product'); |
|
| 89 | - Route::get('/admin/prodotto-variante/{id_product}',[AdminNewProductVariationController::class,'page'])->name('admin.product.new.variante'); |
|
| 86 | + Route::get('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'page'])->name('admin.product.new'); |
|
| 87 | + Route::get('/admin/prodotti', [AdminProductsListController::class, 'page'])->name('admin.product.list'); |
|
| 88 | + Route::get('/admin/prodotto/crea-singolo-prodotto', [AdminNewSingleProductController::class, 'page'])->name('admin.new.single.product'); |
|
| 89 | + Route::get('/admin/prodotto-variante/{id_product}', [AdminNewProductVariationController::class, 'page'])->name('admin.product.new.variante'); |
|
| 90 | 90 | //orders |
| 91 | - Route::get('/admin/ordini',[AdminOrdersController::class,'page'])->name('admin.orders.list'); |
|
| 92 | - Route::get('/admin/ordine/{order_id}',[AdminOrderDetailsController::class,'page'])->name('admin.order'); |
|
| 93 | - Route::get('/admin/clienti',[AdminClientsController::class,'page'])->name('admin.clients'); |
|
| 91 | + Route::get('/admin/ordini', [AdminOrdersController::class, 'page'])->name('admin.orders.list'); |
|
| 92 | + Route::get('/admin/ordine/{order_id}', [AdminOrderDetailsController::class, 'page'])->name('admin.order'); |
|
| 93 | + Route::get('/admin/clienti', [AdminClientsController::class, 'page'])->name('admin.clients'); |
|
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | |
| 97 | 97 | /***************** |
| 98 | 98 | *-----POST------* |
| 99 | 99 | *****************/ |
| 100 | - Route::post('/admin/post/get/categories/tree',[AdminCategoryController::class,'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
| 101 | - Route::post('/admin/post/get/categories',[AdminCategoryController::class,'getCategories'])->name('admin.post.get.categories'); |
|
| 102 | - Route::post('/admin/post/create-new-category',[AdminCategoryController::class,'setNewCategory'])->name('admin.post.create.new.category'); |
|
| 100 | + Route::post('/admin/post/get/categories/tree', [AdminCategoryController::class, 'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
| 101 | + Route::post('/admin/post/get/categories', [AdminCategoryController::class, 'getCategories'])->name('admin.post.get.categories'); |
|
| 102 | + Route::post('/admin/post/create-new-category', [AdminCategoryController::class, 'setNewCategory'])->name('admin.post.create.new.category'); |
|
| 103 | 103 | |
| 104 | 104 | //details |
| 105 | - Route::post('/admin/post/create/detail',[AdminDetailController::class,'setNewDetail'])->name('admin.post.create.detail'); |
|
| 106 | - Route::post('/admin/post/get/details',[AdminDetailController::class,'getDetails'])->name('admin.post.get.details'); |
|
| 105 | + Route::post('/admin/post/create/detail', [AdminDetailController::class, 'setNewDetail'])->name('admin.post.create.detail'); |
|
| 106 | + Route::post('/admin/post/get/details', [AdminDetailController::class, 'getDetails'])->name('admin.post.get.details'); |
|
| 107 | 107 | |
| 108 | 108 | //configuration |
| 109 | - Route::post('/admin/post/create/configuration',[AdminConfigurationFieldController::class,'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
| 110 | - Route::post('/admin/post/get/configuration',[AdminConfigurationFieldController::class,'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
| 109 | + Route::post('/admin/post/create/configuration', [AdminConfigurationFieldController::class, 'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
| 110 | + Route::post('/admin/post/get/configuration', [AdminConfigurationFieldController::class, 'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
| 111 | 111 | |
| 112 | 112 | //product |
| 113 | - Route::post('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'createNewProduct'])->name('admin.post.product.new'); |
|
| 114 | - Route::post('/admin/prodotto/crea-variante-prodotto',[AdminNewProductVariationController::class,'createNewVariation'])->name('admin.post.product.variation.new'); |
|
| 115 | - Route::post('/admin/prodotto/crea-singolo-prodotto',[AdminNewSingleProductController::class,'createNewSingleProduct'])->name('admin.post.new.single.product'); |
|
| 113 | + Route::post('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'createNewProduct'])->name('admin.post.product.new'); |
|
| 114 | + Route::post('/admin/prodotto/crea-variante-prodotto', [AdminNewProductVariationController::class, 'createNewVariation'])->name('admin.post.product.variation.new'); |
|
| 115 | + Route::post('/admin/prodotto/crea-singolo-prodotto', [AdminNewSingleProductController::class, 'createNewSingleProduct'])->name('admin.post.new.single.product'); |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | 118 | //refresh |
| 119 | - Route::get('/admin/update',[AdminUpdatePackageController::class,'update'])->name('admin.updatepackage'); |
|
| 119 | + Route::get('/admin/update', [AdminUpdatePackageController::class, 'update'])->name('admin.updatepackage'); |
|
| 120 | 120 | |
| 121 | 121 | }); |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | |
| 8 | 8 | class AdminClientsController extends Controller |
| 9 | 9 | { |
| 10 | - public function page(){ |
|
| 11 | - $clients = User::where('admin',false)->get(); |
|
| 12 | - return view('mongicommerce::admin.pages.clients',compact('clients')); |
|
| 10 | + public function page() { |
|
| 11 | + $clients = User::where('admin', false)->get(); |
|
| 12 | + return view('mongicommerce::admin.pages.clients', compact('clients')); |
|
| 13 | 13 | } |
| 14 | 14 | } |
@@ -8,11 +8,11 @@ |
||
| 8 | 8 | |
| 9 | 9 | class AdminOrderDetailsController |
| 10 | 10 | { |
| 11 | - public function page($order_id){ |
|
| 11 | + public function page($order_id) { |
|
| 12 | 12 | $order = Order::find($order_id); |
| 13 | 13 | $cliente = $order->user; |
| 14 | 14 | $products = $order->products; |
| 15 | 15 | $statuses = OrderStatus::all(); |
| 16 | - return view('mongicommerce::admin.pages.orders.order_details',compact('cliente','products','order','statuses')); |
|
| 16 | + return view('mongicommerce::admin.pages.orders.order_details', compact('cliente', 'products', 'order', 'statuses')); |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | |
| 6 | 6 | class DashboardController extends Controller |
| 7 | 7 | { |
| 8 | - public function page(){ |
|
| 8 | + public function page() { |
|
| 9 | 9 | return view('mongicommerce::admin.pages.dashboard'); |
| 10 | 10 | } |
| 11 | 11 | } |
@@ -8,9 +8,9 @@ |
||
| 8 | 8 | |
| 9 | 9 | class AdminOrdersController |
| 10 | 10 | { |
| 11 | - public function page(){ |
|
| 11 | + public function page() { |
|
| 12 | 12 | $orders = Order::all(); |
| 13 | 13 | $statuses = OrderStatus::all(); |
| 14 | - return view('mongicommerce::admin.pages.orders.orders_list',['orders' => $orders,'statuses'=> $statuses]); |
|
| 14 | + return view('mongicommerce::admin.pages.orders.orders_list', ['orders' => $orders, 'statuses'=> $statuses]); |
|
| 15 | 15 | } |
| 16 | 16 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class ShopShipmentController extends Controller |
| 14 | 14 | { |
| 15 | - public function page(){ |
|
| 15 | + public function page() { |
|
| 16 | 16 | //if logged in |
| 17 | 17 | $piva = ''; |
| 18 | 18 | $rag_soc = ''; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $province = ''; |
| 26 | 26 | $city = ''; |
| 27 | 27 | $cap = ''; |
| 28 | - if(Auth::check()){ |
|
| 28 | + if (Auth::check()) { |
|
| 29 | 29 | $user = Auth::user(); |
| 30 | 30 | $piva = $user->piva; |
| 31 | 31 | $rag_soc = $user->company; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | Template::MoveSessionToCart($user->id); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - return view('mongicommerce.pages.shipment',compact( |
|
| 44 | + return view('mongicommerce.pages.shipment', compact( |
|
| 45 | 45 | 'piva', |
| 46 | 46 | 'rag_soc', |
| 47 | 47 | 'first_name', |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | $city = $r->get('city'); |
| 84 | 84 | $cap = $r->get('cap'); |
| 85 | 85 | |
| 86 | - $user = User::where('email',$email_sped)->first(); |
|
| 86 | + $user = User::where('email', $email_sped)->first(); |
|
| 87 | 87 | //if user exist |
| 88 | - if($user){ |
|
| 88 | + if ($user) { |
|
| 89 | 89 | $user->piva = $piva; |
| 90 | 90 | $user->company = $rag_soc; |
| 91 | 91 | $user->first_name = $first_name; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $user->cap = $cap; |
| 99 | 99 | $user->save(); |
| 100 | 100 | //if user doesn't exist |
| 101 | - }else{ |
|
| 101 | + } else { |
|
| 102 | 102 | $user = new User(); |
| 103 | 103 | $user->piva = $piva; |
| 104 | 104 | $user->company = $rag_soc; |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | class DefaultController extends Controller |
| 6 | 6 | { |
| 7 | - public function page(){ |
|
| 7 | + public function page() { |
|
| 8 | 8 | return view('mongicommerce.pages.default'); |
| 9 | 9 | } |
| 10 | 10 | } |