Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function edit($id, Category $category)
- {
- $product = Product::where('id',$id)->first();
- $categories = Category::whereNull('category_id')->with('childrenCategories')->get();
- return view('product.edit', compact('categories','product'));
- }
- ErrorException
- Undefined variable: category (View: /var/www/bossphp.x/resources/views/product/edit.blade.php)
- http://bossphp.x:8080/product/edit/38
- <div class="form-group">
- <label>Подкатегории</label>
- <select class="form-control input-sm" name="category_id">
- <!-- --><?php //dd($categories); ?>
- <option selected value="{{$product->category_id}}">--select--</option>
- @foreach ($categories as $firstcategory)
- <option @if($firstcategory->id == $category->category_id) selected @endif value="{{$firstcategory->id}}">{{$firstcategory->title}}</option>
- @if($firstcategory->categories)
- @foreach ($firstcategory->categories as $subcategory)
- <option @if($subcategory->id == $category->category_id) selected @endif value="{{$subcategory->id}}">-----{{$subcategory->title}}</option>
- @endforeach
- @endif
- @endforeach
- </select>
- </div>
Add Comment
Please, Sign In to add comment