@@ -12,16 +12,16 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | class AdminDetailController extends Controller |
| 14 | 14 | { |
| 15 | - public function page(){ |
|
| 15 | + public function page() { |
|
| 16 | 16 | $types_details = config('mongicommerce.details'); |
| 17 | 17 | $configuration_field = config('mongicommerce.description_field'); |
| 18 | - return view('mongicommerce::admin.pages.details.create_details',[ |
|
| 18 | + return view('mongicommerce::admin.pages.details.create_details', [ |
|
| 19 | 19 | 'types' =>$types_details, |
| 20 | 20 | 'configuration_field' => $configuration_field |
| 21 | 21 | ]); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - public function setNewDetail(Request $r){ |
|
| 24 | + public function setNewDetail(Request $r) { |
|
| 25 | 25 | |
| 26 | 26 | $r->validate([ |
| 27 | 27 | 'name' => 'required', |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | $detail->name = $name; |
| 41 | 41 | $detail->save(); |
| 42 | 42 | |
| 43 | - if($type === 'select' || $type === 'checkbox' || $type === 'radio'){ |
|
| 44 | - foreach ($values as $value){ |
|
| 43 | + if ($type === 'select' || $type === 'checkbox' || $type === 'radio') { |
|
| 44 | + foreach ($values as $value) { |
|
| 45 | 45 | $datails_value = new DetailValue(); |
| 46 | 46 | $datails_value->detail_id = $detail->id; |
| 47 | 47 | $datails_value->value = $value; |
@@ -54,16 +54,16 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | |
| 57 | - public function getDetails(Request $r){ |
|
| 57 | + public function getDetails(Request $r) { |
|
| 58 | 58 | $category_id = $r->get('category_id'); |
| 59 | - $details = Detail::where('category_id',$category_id)->get(); |
|
| 59 | + $details = Detail::where('category_id', $category_id)->get(); |
|
| 60 | 60 | $d = []; |
| 61 | - foreach ($details as $detail){ |
|
| 61 | + foreach ($details as $detail) { |
|
| 62 | 62 | $d[] = [ |
| 63 | 63 | 'name' => $detail->name, |
| 64 | 64 | 'type' => $detail->type, |
| 65 | 65 | 'values' => $detail->values, |
| 66 | - 'html' => $this->generateDetailHtml($detail,$detail->values) |
|
| 66 | + 'html' => $this->generateDetailHtml($detail, $detail->values) |
|
| 67 | 67 | ]; |
| 68 | 68 | } |
| 69 | 69 | |
@@ -71,36 +71,36 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function generateDetailHtml($detail,$values){ |
|
| 74 | + public function generateDetailHtml($detail, $values) { |
|
| 75 | 75 | $type = $detail->type; |
| 76 | 76 | $html = ''; |
| 77 | 77 | |
| 78 | - if($type === 'select'){ |
|
| 78 | + if ($type === 'select') { |
|
| 79 | 79 | $html = ''; |
| 80 | - $html .= '<select data-detail_id="'.$detail->id .'" class="form-control mongifield">'; |
|
| 80 | + $html .= '<select data-detail_id="'.$detail->id.'" class="form-control mongifield">'; |
|
| 81 | 81 | $html .= '<option value="">Seleziona</option>'; |
| 82 | - foreach($values as $value){ |
|
| 82 | + foreach ($values as $value) { |
|
| 83 | 83 | $html .= '<option value="'.$value->id.'">'.$value->value.'</option>'; |
| 84 | 84 | } |
| 85 | 85 | $html .= '</select>'; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if($type === 'checkbox'){ |
|
| 88 | + if ($type === 'checkbox') { |
|
| 89 | 89 | $html = ''; |
| 90 | 90 | |
| 91 | - foreach($values as $value){ |
|
| 91 | + foreach ($values as $value) { |
|
| 92 | 92 | $html .= '<div class="custom-control custom-checkbox mongifield">'; |
| 93 | - $html .= '<input data-detail_id="'.$detail->id .'" type="checkbox" class="custom-control-input mongifield" id="defaultUnchecked_'.$value->id.'">'; |
|
| 93 | + $html .= '<input data-detail_id="'.$detail->id.'" type="checkbox" class="custom-control-input mongifield" id="defaultUnchecked_'.$value->id.'">'; |
|
| 94 | 94 | $html .= '<label class="custom-control-label" for="defaultUnchecked_'.$value->id.'">'.$value->value.'</label>'; |
| 95 | 95 | $html .= '</div>'; |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if($type === 'radio'){ |
|
| 99 | + if ($type === 'radio') { |
|
| 100 | 100 | $html = ''; |
| 101 | - foreach($values as $value){ |
|
| 101 | + foreach ($values as $value) { |
|
| 102 | 102 | $html .= '<div class="custom-control custom-radio mongifield">'; |
| 103 | - $html .= '<input name="radio_'.$value->detail_id.'" data-detail_id="'.$detail->id .'" type="radio" class="custom-control-input mongifield" id="defaultradio_'.$value->id.'">'; |
|
| 103 | + $html .= '<input name="radio_'.$value->detail_id.'" data-detail_id="'.$detail->id.'" type="radio" class="custom-control-input mongifield" id="defaultradio_'.$value->id.'">'; |
|
| 104 | 104 | $html .= '<label class="custom-control-label" for="defaultradio_'.$value->id.'">'.$value->value.'</label>'; |
| 105 | 105 | $html .= '</div>'; |
| 106 | 106 | } |
@@ -11,8 +11,8 @@ |
||
| 11 | 11 | { |
| 12 | 12 | use HasFactory; |
| 13 | 13 | |
| 14 | - public function value(){ |
|
| 15 | - return $this->belongsTo(ConfigurationFieldValue::class,'configuration_field_id'); |
|
| 14 | + public function value() { |
|
| 15 | + return $this->belongsTo(ConfigurationFieldValue::class, 'configuration_field_id'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | |
| 13 | 13 | class AdminNewProductController extends Controller |
| 14 | 14 | { |
| 15 | - public function page(){ |
|
| 15 | + public function page() { |
|
| 16 | 16 | return view('mongicommerce::admin.pages.products.new_product'); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - public function createNewProduct(Request $r){ |
|
| 19 | + public function createNewProduct(Request $r) { |
|
| 20 | 20 | |
| 21 | 21 | $r->validate([ |
| 22 | 22 | 'product_name' => 'required', |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | use HasFactory; |
| 13 | 13 | |
| 14 | - public function detail(){ |
|
| 15 | - return $this->belongsTo(DetailValue::class,'product_detail_value_id'); |
|
| 14 | + public function detail() { |
|
| 15 | + return $this->belongsTo(DetailValue::class, 'product_detail_value_id'); |
|
| 16 | 16 | } |
| 17 | 17 | } |
@@ -11,8 +11,8 @@ |
||
| 11 | 11 | { |
| 12 | 12 | use HasFactory; |
| 13 | 13 | |
| 14 | - public function details(){ |
|
| 15 | - return $this->hasMany(ProductItemDetail::class,'product_item_id'); |
|
| 14 | + public function details() { |
|
| 15 | + return $this->hasMany(ProductItemDetail::class, 'product_item_id'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | } |
@@ -11,8 +11,8 @@ |
||
| 11 | 11 | { |
| 12 | 12 | use HasFactory; |
| 13 | 13 | |
| 14 | - public function detail(){ |
|
| 15 | - return $this->belongsTo(Detail::class,'detail_id'); |
|
| 14 | + public function detail() { |
|
| 15 | + return $this->belongsTo(Detail::class, 'detail_id'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | } |
@@ -9,8 +9,8 @@ |
||
| 9 | 9 | |
| 10 | 10 | class AdminProductsListController extends Controller |
| 11 | 11 | { |
| 12 | - public function page(){ |
|
| 12 | + public function page() { |
|
| 13 | 13 | $products = Product::all(); |
| 14 | - return view('mongicommerce::admin.pages.products.products_list',['products' => $products]); |
|
| 14 | + return view('mongicommerce::admin.pages.products.products_list', ['products' => $products]); |
|
| 15 | 15 | } |
| 16 | 16 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | class SettingsSeeder extends Seeder |
| 13 | 13 | { |
| 14 | - public function run(){ |
|
| 14 | + public function run(){ |
|
| 15 | 15 | $settings = new AdminSetting(); |
| 16 | 16 | $settings->shop_name = 'MongiCommerce'; |
| 17 | 17 | $settings->iban = 'DE79100110012626219557'; |
@@ -26,5 +26,5 @@ discard block |
||
| 26 | 26 | $settings->claim_email = '[email protected]'; |
| 27 | 27 | $settings->piva = '12345678901'; |
| 28 | 28 | $settings->save(); |
| 29 | - } |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | |
| 12 | 12 | class SettingsSeeder extends Seeder |
| 13 | 13 | { |
| 14 | - public function run(){ |
|
| 14 | + public function run() { |
|
| 15 | 15 | $settings = new AdminSetting(); |
| 16 | 16 | $settings->shop_name = 'MongiCommerce'; |
| 17 | 17 | $settings->iban = 'DE79100110012626219557'; |
@@ -11,33 +11,33 @@ |
||
| 11 | 11 | use Mongi\Mongicommerce\Http\Controllers\admin\DashboardController; |
| 12 | 12 | |
| 13 | 13 | //BackEnd Pages |
| 14 | -Route::get('/admin/dashboard',[DashboardController::class,'page'])->name('admin.dashboard'); |
|
| 15 | -Route::get('/admin/categorie/',[AdminCategoryController::class,'page'])->name('admin.category.new'); |
|
| 16 | -Route::get('/admin/dettagli',[AdminDetailController::class,'page'])->name('admin.details'); |
|
| 17 | -Route::get('/admin/settings',[AdminSettingsController::class,'page'])->name('admin.settings'); |
|
| 14 | +Route::get('/admin/dashboard', [DashboardController::class, 'page'])->name('admin.dashboard'); |
|
| 15 | +Route::get('/admin/categorie/', [AdminCategoryController::class, 'page'])->name('admin.category.new'); |
|
| 16 | +Route::get('/admin/dettagli', [AdminDetailController::class, 'page'])->name('admin.details'); |
|
| 17 | +Route::get('/admin/settings', [AdminSettingsController::class, 'page'])->name('admin.settings'); |
|
| 18 | 18 | |
| 19 | 19 | //products |
| 20 | -Route::get('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'page'])->name('admin.product.new'); |
|
| 21 | -Route::get('/admin/prodotti',[AdminProductsListController::class,'page'])->name('admin.product.list'); |
|
| 22 | -Route::get('/admin/prodotto-variante/{id_product}',[AdminNewProductVariationController::class,'page'])->name('admin.product.new.variante'); |
|
| 20 | +Route::get('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'page'])->name('admin.product.new'); |
|
| 21 | +Route::get('/admin/prodotti', [AdminProductsListController::class, 'page'])->name('admin.product.list'); |
|
| 22 | +Route::get('/admin/prodotto-variante/{id_product}', [AdminNewProductVariationController::class, 'page'])->name('admin.product.new.variante'); |
|
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | //Post |
| 29 | -Route::post('/admin/post/get/categories/tree',[AdminCategoryController::class,'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
| 30 | -Route::post('/admin/post/get/categories',[AdminCategoryController::class,'getCategories'])->name('admin.post.get.categories'); |
|
| 31 | -Route::post('/admin/post/create-new-category',[AdminCategoryController::class,'setNewCategory'])->name('admin.post.create.new.category'); |
|
| 29 | +Route::post('/admin/post/get/categories/tree', [AdminCategoryController::class, 'getStructureCategories'])->name('admin.post.get.categories.tree'); |
|
| 30 | +Route::post('/admin/post/get/categories', [AdminCategoryController::class, 'getCategories'])->name('admin.post.get.categories'); |
|
| 31 | +Route::post('/admin/post/create-new-category', [AdminCategoryController::class, 'setNewCategory'])->name('admin.post.create.new.category'); |
|
| 32 | 32 | |
| 33 | 33 | //details |
| 34 | -Route::post('/admin/post/create/detail',[AdminDetailController::class,'setNewDetail'])->name('admin.post.create.detail'); |
|
| 35 | -Route::post('/admin/post/get/details',[AdminDetailController::class,'getDetails'])->name('admin.post.get.details'); |
|
| 34 | +Route::post('/admin/post/create/detail', [AdminDetailController::class, 'setNewDetail'])->name('admin.post.create.detail'); |
|
| 35 | +Route::post('/admin/post/get/details', [AdminDetailController::class, 'getDetails'])->name('admin.post.get.details'); |
|
| 36 | 36 | |
| 37 | 37 | //configuration |
| 38 | -Route::post('/admin/post/create/configuration',[AdminConfigurationFieldController::class,'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
| 39 | -Route::post('/admin/post/get/configuration',[AdminConfigurationFieldController::class,'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
| 38 | +Route::post('/admin/post/create/configuration', [AdminConfigurationFieldController::class, 'setNewConfiguration'])->name('admin.post.create.configuration'); |
|
| 39 | +Route::post('/admin/post/get/configuration', [AdminConfigurationFieldController::class, 'getConfigurationFields'])->name('admin.post.get.configuration'); |
|
| 40 | 40 | |
| 41 | 41 | //product |
| 42 | -Route::post('/admin/prodotto/crea-prodotto',[AdminNewProductController::class,'createNewProduct'])->name('admin.post.product.new'); |
|
| 43 | -Route::post('/admin/prodotto/crea-variante-prodotto',[AdminNewProductVariationController::class,'createNewVariation'])->name('admin.post.product.variation.new'); |
|
| 42 | +Route::post('/admin/prodotto/crea-prodotto', [AdminNewProductController::class, 'createNewProduct'])->name('admin.post.product.new'); |
|
| 43 | +Route::post('/admin/prodotto/crea-variante-prodotto', [AdminNewProductVariationController::class, 'createNewVariation'])->name('admin.post.product.variation.new'); |
|