Test Failed
Push — master ( 1f85df...a52154 )
by Gianluca
05:34
created
database/migrations/2020_12_02_085261_create_detail_values_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('detail_values', function (Blueprint $table) {
16
+        Schema::create('detail_values', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->unsignedBigInteger('detail_id');
19 19
             $table->string('value');
Please login to merge, or discard this patch.
src/Http/Controllers/admin/AdminCategoryController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 
11 11
 class AdminCategoryController extends Controller
12 12
 {
13
-    public function page(){
13
+    public function page() {
14 14
         return view('mongicommerce::admin.pages.category.new_category');
15 15
     }
16 16
 
17
-    public function setNewCategory(Request $r){
17
+    public function setNewCategory(Request $r) {
18 18
         $r->validate([
19 19
             'name' => 'required',
20 20
             'description' => 'max:255'
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
         $category->save();
30 30
     }
31 31
 
32
-    public function getCategories(){
32
+    public function getCategories() {
33 33
         $data = $this->getCategoryTree();
34 34
         return Response()->json($data);
35 35
     }
36 36
 
37 37
     function getCategoryTree($parent_id = null, $spacing = '', $tree_array = array()) {
38
-        $categories = Category::select('id', 'name', 'parent_id')->where('parent_id' ,'=', $parent_id)->orderBy('parent_id')->get();
39
-        foreach ($categories as $item){
40
-            $tree_array[] = ['id' => $item->id, 'name' =>$spacing . $item->name] ;
41
-            $tree_array = $this->getCategoryTree($item->id, $spacing . '- ', $tree_array);
38
+        $categories = Category::select('id', 'name', 'parent_id')->where('parent_id', '=', $parent_id)->orderBy('parent_id')->get();
39
+        foreach ($categories as $item) {
40
+            $tree_array[] = ['id' => $item->id, 'name' =>$spacing.$item->name];
41
+            $tree_array = $this->getCategoryTree($item->id, $spacing.'- ', $tree_array);
42 42
         }
43 43
         return $tree_array;
44 44
     }
45 45
 
46
-    public function getStructureCategories(){
46
+    public function getStructureCategories() {
47 47
 
48 48
         $categories = Category::with('children')->whereNull('parent_id')->get();
49 49
         $tree = [];
50
-        foreach($categories as $category){
50
+        foreach ($categories as $category) {
51 51
                 $tree[] = [
52 52
                     'id' => $category->id,
53 53
                     'text' => $category->name,
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
         return response()->json($tree);
59 59
     }
60 60
 
61
-    private function recursiveChildren($childrens){
61
+    private function recursiveChildren($childrens) {
62 62
         $childs = [];
63
-        foreach ($childrens as $children){
63
+        foreach ($childrens as $children) {
64 64
             $childs[] = [
65 65
                 'id' => $children->id,
66 66
                 'text' => $children->name,
Please login to merge, or discard this patch.
src/Models/Detail.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
 {
12 12
     use HasFactory;
13 13
 
14
-    public function values(){
15
-        return $this->hasMany(DetailValue::class,'detail_id');
14
+    public function values() {
15
+        return $this->hasMany(DetailValue::class, 'detail_id');
16 16
     }
17 17
 
18 18
 
Please login to merge, or discard this patch.
database/migrations/2020_12_02_085341_create_product_item_details_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('product_item_details', function (Blueprint $table) {
16
+        Schema::create('product_item_details', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->unsignedBigInteger('product_item_id');
19 19
             $table->unsignedBigInteger('product_detail_id');
Please login to merge, or discard this patch.
database/migrations/2020_12_19_085260_create_configuration_fields_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      */
14 14
     public function up()
15 15
     {
16
-        Schema::create('configuration_fields', function (Blueprint $table) {
16
+        Schema::create('configuration_fields', function(Blueprint $table) {
17 17
             $table->id();
18 18
             $table->string('name');
19 19
             $table->unsignedBigInteger('category_id');
Please login to merge, or discard this patch.
src/Http/Controllers/admin/AdminDetailController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.
src/Models/ProductItemDetail.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Models/DetailValue.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/Http/Controllers/admin/AdminProductsListController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.