@@ -19,10 +19,10 @@ |
||
19 | 19 | return view('mongicommerce.pages.login'); |
20 | 20 | } |
21 | 21 | |
22 | - public function store(LoginRequest $request){ |
|
22 | + public function store(LoginRequest $request) { |
|
23 | 23 | $request->authenticate(); |
24 | 24 | $request->session()->regenerate(); |
25 | - return Redirect::back()->with('message','Loggato con successo!'); |
|
25 | + return Redirect::back()->with('message', 'Loggato con successo!'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function storeAndRedirect(LoginRequest $request) |
@@ -43,7 +43,7 @@ |
||
43 | 43 | 'email_verified_at' => 'datetime', |
44 | 44 | ]; |
45 | 45 | |
46 | - public function orders(){ |
|
47 | - return $this->hasMany(Order::class,'user_id'); |
|
46 | + public function orders() { |
|
47 | + return $this->hasMany(Order::class, 'user_id'); |
|
48 | 48 | } |
49 | 49 | } |
@@ -10,17 +10,17 @@ |
||
10 | 10 | { |
11 | 11 | use HasFactory; |
12 | 12 | |
13 | - public static function getStripeApiKey(){ |
|
13 | + public static function getStripeApiKey() { |
|
14 | 14 | $globalSetting = self::first(); |
15 | 15 | return $globalSetting->stripe_api_key; |
16 | 16 | } |
17 | 17 | |
18 | - public static function getStripeApiSecretKey(){ |
|
18 | + public static function getStripeApiSecretKey() { |
|
19 | 19 | $globalSetting = self::first(); |
20 | 20 | return $globalSetting->stripe_api_secret; |
21 | 21 | } |
22 | 22 | |
23 | - public static function getIban(){ |
|
23 | + public static function getIban() { |
|
24 | 24 | $globalSetting = self::first(); |
25 | 25 | return $globalSetting->iban; |
26 | 26 | } |
@@ -14,21 +14,21 @@ |
||
14 | 14 | { |
15 | 15 | use HasFactory; |
16 | 16 | |
17 | - protected $dates = ["created_at","updated_at"]; |
|
17 | + protected $dates = ["created_at", "updated_at"]; |
|
18 | 18 | |
19 | - public function status(){ |
|
20 | - return $this->belongsTo(OrderStatus::class,'status_id'); |
|
19 | + public function status() { |
|
20 | + return $this->belongsTo(OrderStatus::class, 'status_id'); |
|
21 | 21 | } |
22 | 22 | |
23 | - public function typePayment(){ |
|
24 | - return $this->belongsTo(TypePayment::class,'payment_type_id'); |
|
23 | + public function typePayment() { |
|
24 | + return $this->belongsTo(TypePayment::class, 'payment_type_id'); |
|
25 | 25 | } |
26 | 26 | |
27 | - public function user(){ |
|
28 | - return $this->belongsTo(User::class,'user_id'); |
|
27 | + public function user() { |
|
28 | + return $this->belongsTo(User::class, 'user_id'); |
|
29 | 29 | } |
30 | 30 | |
31 | - public function products(){ |
|
32 | - return $this->belongsToMany(ProductItem::class,'product_order','order_id','product_item_id')->withPivot('number_products'); |
|
31 | + public function products() { |
|
32 | + return $this->belongsToMany(ProductItem::class, 'product_order', 'order_id', 'product_item_id')->withPivot('number_products'); |
|
33 | 33 | } |
34 | 34 | } |
@@ -12,15 +12,15 @@ |
||
12 | 12 | { |
13 | 13 | use HasFactory; |
14 | 14 | protected $table = 'cart'; |
15 | - protected $dates = ["created_at","updated_at"]; |
|
15 | + protected $dates = ["created_at", "updated_at"]; |
|
16 | 16 | |
17 | 17 | |
18 | - public function user(){ |
|
19 | - return $this->belongsTo(User::class,'user_id'); |
|
18 | + public function user() { |
|
19 | + return $this->belongsTo(User::class, 'user_id'); |
|
20 | 20 | } |
21 | 21 | |
22 | - static function emptyCart(){ |
|
23 | - self::where('user_id',Auth::user()->id)->delete(); |
|
22 | + static function emptyCart() { |
|
23 | + self::where('user_id', Auth::user()->id)->delete(); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('product_order', function (Blueprint $table) { |
|
16 | + Schema::create('product_order', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->unsignedBigInteger('order_id'); |
19 | 19 | $table->unsignedBigInteger('product_item_id'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::table('users', function (Blueprint $table) { |
|
16 | + Schema::table('users', function(Blueprint $table) { |
|
17 | 17 | $table->string('name')->nullable()->change(); |
18 | 18 | $table->string('first_name')->nullable(); |
19 | 19 | $table->string('last_name')->nullable(); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | use Mongi\Mongicommerce\Http\Controllers\admin\AdminNewProductVariationController; |
28 | 28 | |
29 | 29 | |
30 | -Route::group(['middleware' => ['web']], function () { |
|
30 | +Route::group(['middleware' => ['web']], function() { |
|
31 | 31 | /***************** |
32 | 32 | *-----SHOP------* |
33 | 33 | *****************/ |
@@ -49,27 +49,27 @@ discard block |
||
49 | 49 | Route::get('/page/shop/user/settings', [ShopUserController::class, 'page'])->name('shop.user.settings'); |
50 | 50 | |
51 | 51 | |
52 | - Route::get('/shop/{id?}',[ShopController::class,'page'])->name('shop'); |
|
53 | - Route::get('/prodotto/{id}/{item_id?}',[ShopSingleProductController::class,'page'])->name('shop.single.product'); |
|
54 | - Route::get('page/shop/cart/',[ShopCartController::class,'page'])->name('shop.cart'); |
|
55 | - Route::get('page/shop/summary/',[ShopSummaryController::class,'page'])->name('shop.summary'); |
|
56 | - Route::get('page/shop/shipment/',[ShopShipmentController::class,'page'])->name('shop.shipment'); |
|
57 | - Route::get('page/shop/checkout/',[ShopCheckoutController::class,'page'])->name('shop.checkout'); |
|
58 | - Route::get('page/shop/payment/',[ShopPaymentController::class,'page'])->name('shop.payment'); |
|
52 | + Route::get('/shop/{id?}', [ShopController::class, 'page'])->name('shop'); |
|
53 | + Route::get('/prodotto/{id}/{item_id?}', [ShopSingleProductController::class, 'page'])->name('shop.single.product'); |
|
54 | + Route::get('page/shop/cart/', [ShopCartController::class, 'page'])->name('shop.cart'); |
|
55 | + Route::get('page/shop/summary/', [ShopSummaryController::class, 'page'])->name('shop.summary'); |
|
56 | + Route::get('page/shop/shipment/', [ShopShipmentController::class, 'page'])->name('shop.shipment'); |
|
57 | + Route::get('page/shop/checkout/', [ShopCheckoutController::class, 'page'])->name('shop.checkout'); |
|
58 | + Route::get('page/shop/payment/', [ShopPaymentController::class, 'page'])->name('shop.payment'); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | |
62 | - Route::post('/shop/get/product-information',[ShopShowVariationProductController::class,'getData'])->name('shop.get.product.information'); |
|
63 | - Route::post('/shop/addtocart',[ShopCartController::class,'addToCart'])->name('shop.addtocart'); |
|
64 | - Route::post('/shop/getcartelements',[ShopCartController::class,'getCartElements'])->name('shop.getcartelements'); |
|
62 | + Route::post('/shop/get/product-information', [ShopShowVariationProductController::class, 'getData'])->name('shop.get.product.information'); |
|
63 | + Route::post('/shop/addtocart', [ShopCartController::class, 'addToCart'])->name('shop.addtocart'); |
|
64 | + Route::post('/shop/getcartelements', [ShopCartController::class, 'getCartElements'])->name('shop.getcartelements'); |
|
65 | 65 | |
66 | - Route::post('/shop/getcartproducts/',[ShopCartController::class,'getCartProducts'])->name('getcartproducts'); |
|
67 | - Route::post('/shop/increment_number_product_in_cart/',[ShopCartController::class,'incrementOrDecrementElementInCart'])->name('increment_number_product_in_cart'); |
|
68 | - Route::post('/shop/delete_from_cart',[ShopCartController::class,'deleteFromCart'])->name('delete_from_cart'); |
|
69 | - Route::post('/shop/save_cache_details_order',[ShopCheckoutController::class,'saveDetailsInSession'])->name('save_cache_details_order'); |
|
70 | - Route::post('/shop/gotocheckout',[ShopShipmentController::class,'goToCheckout'])->name('shop.gotocheckout'); |
|
71 | - Route::post('/shop/pay',[ShopPaymentController::class,'pay'])->name('shop.pay'); |
|
72 | - Route::post('/shop/normalpayment',[ShopPaymentController::class,'normalPayment'])->name('shop.normalpayment'); |
|
66 | + Route::post('/shop/getcartproducts/', [ShopCartController::class, 'getCartProducts'])->name('getcartproducts'); |
|
67 | + Route::post('/shop/increment_number_product_in_cart/', [ShopCartController::class, 'incrementOrDecrementElementInCart'])->name('increment_number_product_in_cart'); |
|
68 | + Route::post('/shop/delete_from_cart', [ShopCartController::class, 'deleteFromCart'])->name('delete_from_cart'); |
|
69 | + Route::post('/shop/save_cache_details_order', [ShopCheckoutController::class, 'saveDetailsInSession'])->name('save_cache_details_order'); |
|
70 | + Route::post('/shop/gotocheckout', [ShopShipmentController::class, 'goToCheckout'])->name('shop.gotocheckout'); |
|
71 | + Route::post('/shop/pay', [ShopPaymentController::class, 'pay'])->name('shop.pay'); |
|
72 | + Route::post('/shop/normalpayment', [ShopPaymentController::class, 'normalPayment'])->name('shop.normalpayment'); |
|
73 | 73 | |
74 | 74 | |
75 | 75 | |
@@ -79,44 +79,44 @@ discard block |
||
79 | 79 | /***************** |
80 | 80 | *------GET------* |
81 | 81 | *****************/ |
82 | - Route::get('/admin/dashboard',[DashboardController::class,'page'])->name('admin.dashboard'); |
|
83 | - Route::get('/admin/categorie/',[AdminCategoryController::class,'page'])->name('admin.category.new'); |
|
84 | - Route::get('/admin/dettagli',[AdminDetailController::class,'page'])->name('admin.details'); |
|
85 | - Route::get('/admin/settings',[AdminSettingsController::class,'page'])->name('admin.settings'); |
|
82 | + Route::get('/admin/dashboard', [DashboardController::class, 'page'])->name('admin.dashboard'); |
|
83 | + Route::get('/admin/categorie/', [AdminCategoryController::class, 'page'])->name('admin.category.new'); |
|
84 | + Route::get('/admin/dettagli', [AdminDetailController::class, 'page'])->name('admin.details'); |
|
85 | + Route::get('/admin/settings', [AdminSettingsController::class, 'page'])->name('admin.settings'); |
|
86 | 86 | //products |
87 | - Route::get('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'page'])->name('admin.product.new'); |
|
88 | - Route::get('/admin/prodotti',[AdminProductsListController::class,'page'])->name('admin.product.list'); |
|
89 | - Route::get('/admin/prodotto/crea-singolo-prodotto',[AdminNewSingleProductController::class,'page'])->name('admin.new.single.product'); |
|
90 | - Route::get('/admin/prodotto-variante/{id_product}',[AdminNewProductVariationController::class,'page'])->name('admin.product.new.variante'); |
|
87 | + Route::get('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'page'])->name('admin.product.new'); |
|
88 | + Route::get('/admin/prodotti', [AdminProductsListController::class, 'page'])->name('admin.product.list'); |
|
89 | + Route::get('/admin/prodotto/crea-singolo-prodotto', [AdminNewSingleProductController::class, 'page'])->name('admin.new.single.product'); |
|
90 | + Route::get('/admin/prodotto-variante/{id_product}', [AdminNewProductVariationController::class, 'page'])->name('admin.product.new.variante'); |
|
91 | 91 | //orders |
92 | - Route::get('/admin/ordini',[AdminOrdersController::class,'page'])->name('admin.orders.list'); |
|
93 | - Route::get('/admin/ordine/{order_id}',[AdminOrderDetailsController::class,'page'])->name('admin.order'); |
|
94 | - Route::get('/admin/clienti',[AdminClientsController::class,'page'])->name('admin.clients'); |
|
92 | + Route::get('/admin/ordini', [AdminOrdersController::class, 'page'])->name('admin.orders.list'); |
|
93 | + Route::get('/admin/ordine/{order_id}', [AdminOrderDetailsController::class, 'page'])->name('admin.order'); |
|
94 | + Route::get('/admin/clienti', [AdminClientsController::class, 'page'])->name('admin.clients'); |
|
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | 98 | /***************** |
99 | 99 | *-----POST------* |
100 | 100 | *****************/ |
101 | - Route::post('/admin/post/get/categories/tree',[AdminCategoryController::class,'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
102 | - Route::post('/admin/post/get/categories',[AdminCategoryController::class,'getCategories'])->name('admin.post.get.categories'); |
|
103 | - Route::post('/admin/post/create-new-category',[AdminCategoryController::class,'setNewCategory'])->name('admin.post.create.new.category'); |
|
101 | + Route::post('/admin/post/get/categories/tree', [AdminCategoryController::class, 'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
102 | + Route::post('/admin/post/get/categories', [AdminCategoryController::class, 'getCategories'])->name('admin.post.get.categories'); |
|
103 | + Route::post('/admin/post/create-new-category', [AdminCategoryController::class, 'setNewCategory'])->name('admin.post.create.new.category'); |
|
104 | 104 | |
105 | 105 | //details |
106 | - Route::post('/admin/post/create/detail',[AdminDetailController::class,'setNewDetail'])->name('admin.post.create.detail'); |
|
107 | - Route::post('/admin/post/get/details',[AdminDetailController::class,'getDetails'])->name('admin.post.get.details'); |
|
106 | + Route::post('/admin/post/create/detail', [AdminDetailController::class, 'setNewDetail'])->name('admin.post.create.detail'); |
|
107 | + Route::post('/admin/post/get/details', [AdminDetailController::class, 'getDetails'])->name('admin.post.get.details'); |
|
108 | 108 | |
109 | 109 | //configuration |
110 | - Route::post('/admin/post/create/configuration',[AdminConfigurationFieldController::class,'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
111 | - Route::post('/admin/post/get/configuration',[AdminConfigurationFieldController::class,'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
110 | + Route::post('/admin/post/create/configuration', [AdminConfigurationFieldController::class, 'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
111 | + Route::post('/admin/post/get/configuration', [AdminConfigurationFieldController::class, 'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
112 | 112 | |
113 | 113 | //product |
114 | - Route::post('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'createNewProduct'])->name('admin.post.product.new'); |
|
115 | - Route::post('/admin/prodotto/crea-variante-prodotto',[AdminNewProductVariationController::class,'createNewVariation'])->name('admin.post.product.variation.new'); |
|
116 | - Route::post('/admin/prodotto/crea-singolo-prodotto',[AdminNewSingleProductController::class,'createNewSingleProduct'])->name('admin.post.new.single.product'); |
|
114 | + Route::post('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'createNewProduct'])->name('admin.post.product.new'); |
|
115 | + Route::post('/admin/prodotto/crea-variante-prodotto', [AdminNewProductVariationController::class, 'createNewVariation'])->name('admin.post.product.variation.new'); |
|
116 | + Route::post('/admin/prodotto/crea-singolo-prodotto', [AdminNewSingleProductController::class, 'createNewSingleProduct'])->name('admin.post.new.single.product'); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | //refresh |
120 | - Route::get('/admin/update',[AdminUpdatePackageController::class,'update'])->name('admin.updatepackage'); |
|
120 | + Route::get('/admin/update', [AdminUpdatePackageController::class, 'update'])->name('admin.updatepackage'); |
|
121 | 121 | |
122 | 122 | }); |
@@ -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,15 +49,15 @@ 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 | |
56 | - if(file_exists(resource_path('/views/mongicommerce'))){ |
|
56 | + if (file_exists(resource_path('/views/mongicommerce'))) { |
|
57 | 57 | File::deleteDirectory(resource_path('/views/mongicommerce')); |
58 | 58 | } |
59 | 59 | |
60 | - if(file_exists(public_path('/mongicommerce/template'))){ |
|
60 | + if (file_exists(public_path('/mongicommerce/template'))) { |
|
61 | 61 | File::deleteDirectory(public_path('/mongicommerce/template')); |
62 | 62 | } |
63 | 63 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'mongicommerce'); |
102 | 102 | |
103 | 103 | // Register the main class to use with the facade |
104 | - $this->app->singleton('mongicommerce', function () { |
|
104 | + $this->app->singleton('mongicommerce', function() { |
|
105 | 105 | return new Mongicommerce; |
106 | 106 | }); |
107 | 107 | } |