@@ -11,13 +11,13 @@ |
||
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 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('product_configuration_fields', function (Blueprint $table) { |
|
16 | + Schema::create('product_configuration_fields', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->unsignedBigInteger('product_item_id'); |
19 | 19 | $table->unsignedBigInteger('config_field_id'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('admin_settings', function (Blueprint $table) { |
|
16 | + Schema::create('admin_settings', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->string('shop_name')->default('MongiCommerce'); |
19 | 19 | $table->string('iban')->default('DE79100110012626219557'); |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
27 | 27 | $this->loadRoutesFrom(__DIR__.'/routes.php'); |
28 | 28 | |
29 | - if(Schema::hasTable('admin_settings')){ |
|
29 | + if (Schema::hasTable('admin_settings')) { |
|
30 | 30 | //inject global information into views |
31 | 31 | View::share('mongicommerce', AdminSetting::first()); |
32 | 32 | } |
33 | 33 | |
34 | - if(Schema::hasTable('categories')){ |
|
34 | + if (Schema::hasTable('categories')) { |
|
35 | 35 | //inject global information into views |
36 | 36 | View::share('categories', Template::getStructureCategories()); |
37 | 37 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if ($this->app->runningInConsole()) { |
41 | 41 | |
42 | 42 | $config_file = config_path('mongicommerce.php'); |
43 | - if(file_exists($config_file)){ |
|
43 | + if (file_exists($config_file)) { |
|
44 | 44 | File::delete($config_file); |
45 | 45 | } |
46 | 46 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | __DIR__.'/../config/config.php' => config_path('mongicommerce.php'), |
50 | 50 | ], 'config'); |
51 | 51 | |
52 | - if(file_exists(resource_path('/views/mongicommerce'))){ |
|
52 | + if (file_exists(resource_path('/views/mongicommerce'))) { |
|
53 | 53 | File::deleteDirectory(resource_path('/views/mongicommerce')); |
54 | 54 | } |
55 | 55 | // Publishing the views. |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | __DIR__.'/../resources/views/shop' => resource_path('/views/mongicommerce'), |
58 | 58 | ], 'views'); |
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 | // Publishing assets. |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'mongicommerce'); |
88 | 88 | |
89 | 89 | // Register the main class to use with the facade |
90 | - $this->app->singleton('mongicommerce', function () { |
|
90 | + $this->app->singleton('mongicommerce', function() { |
|
91 | 91 | return new Mongicommerce; |
92 | 92 | }); |
93 | 93 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | *-----SHOP------* |
17 | 17 | *****************/ |
18 | 18 | |
19 | -Route::get('/shop/{id?}',[ShopController::class,'page'])->name('shop'); |
|
19 | +Route::get('/shop/{id?}', [ShopController::class, 'page'])->name('shop'); |
|
20 | 20 | |
21 | 21 | |
22 | 22 | |
@@ -24,38 +24,38 @@ discard block |
||
24 | 24 | /***************** |
25 | 25 | *------GET------* |
26 | 26 | *****************/ |
27 | -Route::get('/admin/dashboard',[DashboardController::class,'page'])->name('admin.dashboard'); |
|
28 | -Route::get('/admin/categorie/',[AdminCategoryController::class,'page'])->name('admin.category.new'); |
|
29 | -Route::get('/admin/dettagli',[AdminDetailController::class,'page'])->name('admin.details'); |
|
30 | -Route::get('/admin/settings',[AdminSettingsController::class,'page'])->name('admin.settings'); |
|
27 | +Route::get('/admin/dashboard', [DashboardController::class, 'page'])->name('admin.dashboard'); |
|
28 | +Route::get('/admin/categorie/', [AdminCategoryController::class, 'page'])->name('admin.category.new'); |
|
29 | +Route::get('/admin/dettagli', [AdminDetailController::class, 'page'])->name('admin.details'); |
|
30 | +Route::get('/admin/settings', [AdminSettingsController::class, 'page'])->name('admin.settings'); |
|
31 | 31 | //products |
32 | -Route::get('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'page'])->name('admin.product.new'); |
|
33 | -Route::get('/admin/prodotti',[AdminProductsListController::class,'page'])->name('admin.product.list'); |
|
34 | -Route::get('/admin/prodotto-variante/{id_product}',[AdminNewProductVariationController::class,'page'])->name('admin.product.new.variante'); |
|
32 | +Route::get('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'page'])->name('admin.product.new'); |
|
33 | +Route::get('/admin/prodotti', [AdminProductsListController::class, 'page'])->name('admin.product.list'); |
|
34 | +Route::get('/admin/prodotto-variante/{id_product}', [AdminNewProductVariationController::class, 'page'])->name('admin.product.new.variante'); |
|
35 | 35 | //orders |
36 | -Route::get('/admin/ordini',[AdminOrdersController::class,'page'])->name('admin.orders.list'); |
|
36 | +Route::get('/admin/ordini', [AdminOrdersController::class, 'page'])->name('admin.orders.list'); |
|
37 | 37 | |
38 | 38 | |
39 | 39 | |
40 | 40 | /***************** |
41 | 41 | *-----POST------* |
42 | 42 | *****************/ |
43 | -Route::post('/admin/post/get/categories/tree',[AdminCategoryController::class,'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
44 | -Route::post('/admin/post/get/categories',[AdminCategoryController::class,'getCategories'])->name('admin.post.get.categories'); |
|
45 | -Route::post('/admin/post/create-new-category',[AdminCategoryController::class,'setNewCategory'])->name('admin.post.create.new.category'); |
|
43 | +Route::post('/admin/post/get/categories/tree', [AdminCategoryController::class, 'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
44 | +Route::post('/admin/post/get/categories', [AdminCategoryController::class, 'getCategories'])->name('admin.post.get.categories'); |
|
45 | +Route::post('/admin/post/create-new-category', [AdminCategoryController::class, 'setNewCategory'])->name('admin.post.create.new.category'); |
|
46 | 46 | |
47 | 47 | //details |
48 | -Route::post('/admin/post/create/detail',[AdminDetailController::class,'setNewDetail'])->name('admin.post.create.detail'); |
|
49 | -Route::post('/admin/post/get/details',[AdminDetailController::class,'getDetails'])->name('admin.post.get.details'); |
|
48 | +Route::post('/admin/post/create/detail', [AdminDetailController::class, 'setNewDetail'])->name('admin.post.create.detail'); |
|
49 | +Route::post('/admin/post/get/details', [AdminDetailController::class, 'getDetails'])->name('admin.post.get.details'); |
|
50 | 50 | |
51 | 51 | //configuration |
52 | -Route::post('/admin/post/create/configuration',[AdminConfigurationFieldController::class,'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
53 | -Route::post('/admin/post/get/configuration',[AdminConfigurationFieldController::class,'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
52 | +Route::post('/admin/post/create/configuration', [AdminConfigurationFieldController::class, 'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
53 | +Route::post('/admin/post/get/configuration', [AdminConfigurationFieldController::class, 'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
54 | 54 | |
55 | 55 | //product |
56 | -Route::post('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'createNewProduct'])->name('admin.post.product.new'); |
|
57 | -Route::post('/admin/prodotto/crea-variante-prodotto',[AdminNewProductVariationController::class,'createNewVariation'])->name('admin.post.product.variation.new'); |
|
56 | +Route::post('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'createNewProduct'])->name('admin.post.product.new'); |
|
57 | +Route::post('/admin/prodotto/crea-variante-prodotto', [AdminNewProductVariationController::class, 'createNewVariation'])->name('admin.post.product.variation.new'); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | //refresh |
61 | -Route::post('/admin/update',[AdminUpdatePackageController::class,'update'])->name('admin.updatepackage'); |
|
61 | +Route::post('/admin/update', [AdminUpdatePackageController::class, 'update'])->name('admin.updatepackage'); |
@@ -11,13 +11,13 @@ |
||
11 | 11 | |
12 | 12 | class ShopController extends Controller |
13 | 13 | { |
14 | - public function page($id=null){ |
|
14 | + public function page($id = null) { |
|
15 | 15 | $products = Template::getProducts($id); |
16 | 16 | $category = Category::find($id); |
17 | 17 | $category_name = ''; |
18 | - if($category){ |
|
18 | + if ($category) { |
|
19 | 19 | $category_name = $category->name; |
20 | 20 | }; |
21 | - return view('mongicommerce.pages.shop',compact('products','category_name')); |
|
21 | + return view('mongicommerce.pages.shop', compact('products', 'category_name')); |
|
22 | 22 | } |
23 | 23 | } |
@@ -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 |