{"action":"created","issue":{"url":"https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs/issues/134","repository_url":"https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs","labels_url":"https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs/issues/134/labels{/name}","comments_url":"https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs/issues/134/comments","events_url":"https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs/issues/134/events","html_url":"https://github.com/davejamesmiller/laravel-breadcrumbs/issues/134","id":176096344,"number":134,"title":"Don't understand how to make with nested set","user":{"login":"schel4ok","id":10367464,"avatar_url":"https://avatars.githubusercontent.com/u/10367464?v=3","gravatar_id":"","url":"https://api.github.com/users/schel4ok","html_url":"https://github.com/schel4ok","followers_url":"https://api.github.com/users/schel4ok/followers","following_url":"https://api.github.com/users/schel4ok/following{/other_user}","gists_url":"https://api.github.com/users/schel4ok/gists{/gist_id}","starred_url":"https://api.github.com/users/schel4ok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schel4ok/subscriptions","organizations_url":"https://api.github.com/users/schel4ok/orgs","repos_url":"https://api.github.com/users/schel4ok/repos","events_url":"https://api.github.com/users/schel4ok/events{/privacy}","received_events_url":"https://api.github.com/users/schel4ok/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-09T20:02:02Z","updated_at":"2016-09-12T16:24:00Z","closed_at":null,"body":"**Summary of issue**\r\nDon't understand how to use breadcrumbs with nestedset\r\n\r\n\r\n**The complete error message, including file & line numbers**\r\nWhen I go to route `links.index` I get this error\r\nMissing argument 1 for App\\Http\\Controllers\\FileController::getIndex()\r\n\r\n\r\nWhen I go to route ` links.cat` page is rendered, but breadcrumbs are not showing\r\n\r\nWhen I go to route ` links.item` I get this error\r\nErrorException in RouteServiceProvider.php line 44: Object of class Illuminate\\Routing\\Route could not be converted to string\r\n\r\n\r\n\r\n\r\n**Software versions**\r\nLaravel Breadcrumbs: 3.0.1\r\nLaravel: 5.1.43\r\nPHP: 5.5.28\r\n\r\n\r\nroutes.php\r\n```\r\nRoute::get('/', ['as' => 'home', 'uses' => 'HomeController@index']);\r\nRoute::get('about-us', ['as' => 'about', 'uses' => 'PageController@o_kompanii']);\r\nRoute::get('sitemap', ['as' => 'sitemap', 'uses' => 'CategoryController@sitemap']);\r\nRoute::get('contacts',  ['as' => 'contacts', 'uses' => 'PageController@contacts']);\r\n\r\nRoute::get('news', ['as' => 'news.index', 'uses' => 'NewsController@getIndex']);\r\nRoute::get('news/{newsitem}', ['as' => 'news.item', 'uses' => 'NewsController@getItem']);\r\n\r\nRoute::get('links', ['as' => 'links.index', 'uses' => 'FileController@getIndex']);\r\nRoute::get('links/{linkscat}', ['as' => 'links.cat', 'uses' => 'FileController@getCategory']);\r\nRoute::get('links/{cat}/{linksitem}', ['as' => 'links.item', 'uses' => 'FileController@getItem']);\r\n```\r\n\r\nCategory model is nestedset.\r\n```\r\nHome         (instance of Category model level 0)\r\n-News        (instance of Category model level 1)\r\n--NewsItem1  (instance of News model)\r\n--NewsItem2\r\n--NewsItem3\r\n...\r\n-Links       (instance of Category model level 1)\r\n--LinkItem1  (instance of Link model)\r\n--LinkItem2\r\n--LinkItem3\r\n...\r\n-Catalog     (instance of Category model level 1)\r\n--Cat1       (instance of Category model level 2)\r\n--Product1   (instance of Product model)\r\n--Product2\r\n--Product3\r\n...\r\n--Cat2       (instance of Category model level 2)\r\n---Product1  (instance of Product model)\r\n---Product2\r\n---Product3\r\n...\r\n---Cat3      (instance of Category model level 3)\r\n----Product1 (instance of Product model)\r\n----Product2\r\n----Product3\r\n...\r\n----Cat3      (instance of Category model level 4)\r\n-----Product1 (instance of Product model)\r\n-----Product2\r\n-----Product3\r\n...\r\n```\r\n\r\n\r\nbreadcrumbs.php\r\n```\r\nuse App\\News;\r\n\r\n// Home\r\nBreadcrumbs::register('home', function($breadcrumbs)\r\n{\r\n    $breadcrumbs->push('Главная', route('home'));\r\n});\r\n\r\n// Home > About\r\nBreadcrumbs::register('about', function($breadcrumbs)\r\n{\r\n    $breadcrumbs->parent('home');\r\n    $breadcrumbs->push('О компании', route('about'));\r\n});\r\n\r\n// Home > News\r\nBreadcrumbs::register('news.index', function($breadcrumbs) {\r\n    $breadcrumbs->parent('home');\r\n    $breadcrumbs->push('Новости', route('news.index'));\r\n});\r\n// Home > News > Item\r\nBreadcrumbs::register('news.item', function($breadcrumbs, $item) {\r\n    $breadcrumbs->parent('news.index');\r\n    $breadcrumbs->push($item->title, route('news.item'));\r\n});\r\n// Home > Links\r\nBreadcrumbs::register('links.index', function($breadcrumbs) {\r\n    $breadcrumbs->parent('home');\r\n    $breadcrumbs->push('Ссылки', route('links.index'));\r\n});\r\n// Home > Links > Cat > Item\r\nBreadcrumbs::register('links.item', function($breadcrumbs, $cat, $item) {\r\n    $breadcrumbs->parent('links.index');\r\n    foreach ($category->ancestors as $ancestor) {\r\n        $breadcrumbs->push($ancestor->title, route('links.cat'));\r\n    }\r\n    $breadcrumbs->push($item->title, route('links.item'));\r\n});\r\n```\r\n\r\nHomeController.php\r\nhere I just get home category, which has sef=bez-kategorii\r\n```\r\n\tpublic function index()\r\n\t{\r\n\t\t$category = Category::where('sef', '=', 'bez-kategorii')->first();\r\n\t\treturn view('home')->withCategory($category);\r\n\t}\r\n```\r\n\r\n\r\nFileController.php\r\n```\r\n\tpublic function getIndex($category)\r\n\t{\r\n\t\t$category = Category::where('type', '=', 'link')->first();\r\n\t\t$categories = $category->descendants()->orderBy('title', 'asc')->paginate(9);\r\n\r\n\t\treturn view('links.index')->withCategory($category)\r\n\t\t\t\t\t  ->withCategories($categories);\r\n\t}\r\n\r\n\tpublic function getCategory($category)\r\n\t{\r\n\t\t$items = Link::where('category_id', $category->id)->paginate(20);\r\n\t\t$previous = $category->getPrevSibling();\r\n\t\t$next = $category->getNextSibling();\r\n\r\n\t\treturn view('links.cat')->withCategory($category)\r\n\t\t\t\t\t->withItems($items)\r\n\t\t\t\t\t->withPrevious($previous)\r\n\t\t\t\t\t->withNext($next);\r\n\t}\r\n\r\n\tpublic function getItem($category, $item)\r\n\t{\r\n\t\t\t$previous = Link::where('id', '<', $item->id)->orderBy('id', 'desc')->first();\r\n\t\t\t$next = Link::where('id', '>', $item->id)->orderBy('id', 'asc')->first();\r\n\r\n\t\t\treturn view('links.item')->withCategory($category)\r\n\t\t\t\t\t\t\t\t\t ->withItem($item)\r\n\t\t\t\t\t\t\t\t\t ->withPrevious($previous)\r\n\t\t\t\t\t\t\t\t\t ->withNext($next);\r\n\t}\r\n\r\n```\r\n\r\nRouteServiceProvider.php\r\n```\r\n<?php namespace App\\Providers;\r\n\r\nuse Illuminate\\Routing\\Router;\r\nuse Illuminate\\Foundation\\Support\\Providers\\RouteServiceProvider as ServiceProvider;\r\nuse Route;\r\nuse App\\News;\r\nuse App\\Link;\r\nuse App\\Category;\r\n\r\nclass RouteServiceProvider extends ServiceProvider\r\n{\r\n    public function boot(Router $router)\r\n    {\r\n        parent::boot($router);\r\n\r\n        Route::bind('newsitem', function($item) {\r\n            return News::whereSef($item)->firstOrFail();\r\n        });\r\n\r\n        Route::bind('links', function($cat) {\r\n            return Category::whereSef($cat)->firstOrFail();\r\n        });\r\n\r\n        Route::bind('linkscat', function($cat) {\r\n            return Category::whereSef($cat)->firstOrFail();\r\n        });\r\n\r\n        Route::bind('linksitem', function($cat, $item) {\r\n            return Link::whereUrl('links/'.$cat.'/'.$item)->firstOrFail();\r\n        });\r\n    }\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs/issues/comments/246403506","html_url":"https://github.com/davejamesmiller/laravel-breadcrumbs/issues/134#issuecomment-246403506","issue_url":"https://api.github.com/repos/davejamesmiller/laravel-breadcrumbs/issues/134","id":246403506,"user":{"login":"schel4ok","id":10367464,"avatar_url":"https://avatars.githubusercontent.com/u/10367464?v=3","gravatar_id":"","url":"https://api.github.com/users/schel4ok","html_url":"https://github.com/schel4ok","followers_url":"https://api.github.com/users/schel4ok/followers","following_url":"https://api.github.com/users/schel4ok/following{/other_user}","gists_url":"https://api.github.com/users/schel4ok/gists{/gist_id}","starred_url":"https://api.github.com/users/schel4ok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schel4ok/subscriptions","organizations_url":"https://api.github.com/users/schel4ok/orgs","repos_url":"https://api.github.com/users/schel4ok/repos","events_url":"https://api.github.com/users/schel4ok/events{/privacy}","received_events_url":"https://api.github.com/users/schel4ok/received_events","type":"User","site_admin":false},"created_at":"2016-09-12T16:24:00Z","updated_at":"2016-09-12T16:24:00Z","body":"yes I saw  `$breadcrumbs->parent($name, $param1, ...)`  and `$breadcrumbs->parent('category', $category->parent);`\r\nThat is why I started to play and check it with different variables.\r\n\r\nBut there is no clear description what we can pass in additional parameters for `$breadcrumbs->parent`"}}
{"actor":{"display_login":"schel4ok"}}