Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

nested array in laravel

class MenuController {
    public function lisItem($category_name, $product_name) {
        $category = Category::where('name', $category_name)->first(['id']);
        $product = Product::where('category_id', $category->id)->where('name', $product_name')->first();
    }
}

Route::get('/{category}/{item}', ['as' => 'named.route' , 'uses' => 'MenuController@listItem']);

// to get the actual linke
route('named.route', ['category' => $category->id, 'item' => $item->id]);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #nested #array #laravel
ADD COMMENT
Topic
Name
3+4 =