{"action":"created","issue":{"url":"https://api.github.com/repos/dingo/api/issues/808","repository_url":"https://api.github.com/repos/dingo/api","labels_url":"https://api.github.com/repos/dingo/api/issues/808/labels{/name}","comments_url":"https://api.github.com/repos/dingo/api/issues/808/comments","events_url":"https://api.github.com/repos/dingo/api/issues/808/events","html_url":"https://github.com/dingo/api/issues/808","id":126032358,"number":808,"title":"Dingo\\Api\\Dispatcher not respecting route","user":{"login":"arthurkirkosa","id":1099791,"avatar_url":"https://avatars.githubusercontent.com/u/1099791?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurkirkosa","html_url":"https://github.com/arthurkirkosa","followers_url":"https://api.github.com/users/arthurkirkosa/followers","following_url":"https://api.github.com/users/arthurkirkosa/following{/other_user}","gists_url":"https://api.github.com/users/arthurkirkosa/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurkirkosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurkirkosa/subscriptions","organizations_url":"https://api.github.com/users/arthurkirkosa/orgs","repos_url":"https://api.github.com/users/arthurkirkosa/repos","events_url":"https://api.github.com/users/arthurkirkosa/events{/privacy}","received_events_url":"https://api.github.com/users/arthurkirkosa/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dingo/api/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2016-01-11T20:43:31Z","updated_at":"2016-03-10T13:56:49Z","closed_at":null,"body":"The App Controller\r\n```php\r\n<?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nclass CustomersController extends Controller\r\n{\r\n    /**\r\n     * @var Dingo\\Api\\Dispatcher\r\n     */\r\n    protected $dispatcher;\r\n\r\n    /**\r\n     * Initialize\r\n     *\r\n     * @param Dingo\\Api\\Dispatcher $dispatcher\r\n     */\r\n    public function __construct(Dispatcher $dispatcher)\r\n    {\r\n        $this->middleware('auth');\r\n\r\n        $this->dispatcher = $dispatcher;\r\n    }\r\n\r\n    /**\r\n     * Display a listing of the resource.\r\n     *\r\n     * @return \\Illuminate\\Http\\Response\r\n     */\r\n    public function index()\r\n    {\r\n        $customers = $this->dispatcher->version('v0')->get('customers');\r\n        // $customers = Customer::all();\r\n\r\n        return view('customers.index', compact('customers'));\r\n    }\r\n...\r\n}\r\n```\r\n\r\nThe API Controller\r\n```php\r\n<?php\r\n\r\nnamespace App\\Http\\Controllers\\Api\\V0;\r\n\r\nclass CustomersController extends Controller\r\n{\r\n    /**\r\n     * Initialize\r\n     */\r\n    public function __construct()\r\n    {\r\n        $this->middleware('auth');\r\n    }\r\n\r\n    /**\r\n     * Display a listing of the resource.\r\n     *\r\n     * @return \\Illuminate\\Http\\Response\r\n     */\r\n    public function index()\r\n    {\r\n        return Customer::all();\r\n    }\r\n...\r\n}\r\n```\r\n\r\nThe Test\r\n```php\r\n...\r\n    /** @test */\r\n    public function it_creates_a_new_customer()\r\n    {\r\n        $store = factory(Store::class)->create();\r\n\r\n        $dummy = factory(Customer::class)->make([\r\n            'store_id' => $store->id,\r\n        ]);\r\n\r\n        $this->visit(route('customers.create'))\r\n             ->see('Adauga un client nou.')\r\n             ->select($store->id, 'store_id')\r\n             ->type($dummy->first_name, 'first_name')\r\n             ->type($dummy->last_name, 'last_name')\r\n             ->type($dummy->email, 'email')\r\n             ->type($dummy->phone, 'phone')\r\n             ->press('Add')\r\n             ->seePageIs(route('customers.index')) // **This is not working anymore**\r\n             ->see($dummy->name);\r\n\r\n        $data = array_only($dummy->toArray(), [\r\n            'first_name', 'last_name',\r\n            'phone', 'email',\r\n        ]);\r\n\r\n        $this->seeInDatabase('customers', $data);\r\n\r\n        $customer = Customer::first();\r\n\r\n        $this->assertEquals(\"{$dummy->first_name} {$dummy->last_name}\", $customer->name);\r\n        $this->assertNotNull($customer->token);\r\n    }\r\n...\r\n```\r\n\r\nThe ```$this->seePageIs(route('customers.index'))``` is not working anymore; it records as being still on the create page.\r\n```\r\n1) CustomerTest::it_creates_a_new_customer\r\nDid not land on expected page [http://localhost/customers].\r\n\r\nFailed asserting that two strings are equal.\r\n--- Expected\r\n+++ Actual\r\n@@ @@\r\n-'http://localhost/customers'\r\n+'http://localhost/customers/create'\r\n```\r\n\r\nThis all works well if I comment out this code ```$customers = $this->dispatcher->version('v0')->get('customers');``` from the Controller and leave the Eloquent object in.\r\n\r\nIt works well if I view the ```customers.index``` route in the browser. Even adding a new customer works well in the browser."},"comment":{"url":"https://api.github.com/repos/dingo/api/issues/comments/194853180","html_url":"https://github.com/dingo/api/issues/808#issuecomment-194853180","issue_url":"https://api.github.com/repos/dingo/api/issues/808","id":194853180,"user":{"login":"arthurkirkosa","id":1099791,"avatar_url":"https://avatars.githubusercontent.com/u/1099791?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurkirkosa","html_url":"https://github.com/arthurkirkosa","followers_url":"https://api.github.com/users/arthurkirkosa/followers","following_url":"https://api.github.com/users/arthurkirkosa/following{/other_user}","gists_url":"https://api.github.com/users/arthurkirkosa/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurkirkosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurkirkosa/subscriptions","organizations_url":"https://api.github.com/users/arthurkirkosa/orgs","repos_url":"https://api.github.com/users/arthurkirkosa/repos","events_url":"https://api.github.com/users/arthurkirkosa/events{/privacy}","received_events_url":"https://api.github.com/users/arthurkirkosa/received_events","type":"User","site_admin":false},"created_at":"2016-03-10T13:56:49Z","updated_at":"2016-03-10T13:56:49Z","body":"https://github.com/dingo/api/commit/05cbc2918e118ad71a0f44dfd754552c7388c27e\r\n\r\nThis build broke it."}}