@@ -855,7 +855,7 @@ |
||
855 | 855 | <?php $link = "" ?> |
856 | 856 | @for($i = 1; $i <= count(Request::segments()); $i++) |
857 | 857 | @if($i < count(Request::segments()) & $i > 0) |
858 | - <?php $link .= "/" . Request::segment($i); ?> |
|
858 | + <?php $link .= "/".Request::segment($i); ?> |
|
859 | 859 | <li class="breadcrumb-item active"> <a href="<?= $link ?>">{{ ucwords(str_replace('-',' ',Request::segment($i)))}}</a> </li> > |
860 | 860 | @else {{ucwords(str_replace('-',' ',Request::segment($i)))}} |
861 | 861 | @endif |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('categories', function (Blueprint $table) { |
|
16 | + Schema::create('categories', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->string('description')->nullable(); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('details', function (Blueprint $table) { |
|
16 | + Schema::create('details', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->string('name'); |
19 | 19 | $table->unsignedBigInteger('category_id'); |
@@ -13,7 +13,7 @@ |
||
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'); |
@@ -10,11 +10,11 @@ discard block |
||
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 |
||
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 |
||
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, |
@@ -11,8 +11,8 @@ |
||
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 |
@@ -13,7 +13,7 @@ |
||
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'); |
@@ -13,7 +13,7 @@ |
||
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'); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('product_items', function (Blueprint $table) { |
|
16 | + Schema::create('product_items', function(Blueprint $table) { |
|
17 | 17 | $table->id(); |
18 | 18 | $table->unsignedBigInteger('product_id'); |
19 | 19 | $table->text('img')->nullable(); |