{"action":"created","issue":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/363","labels_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/363/labels{/name}","comments_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/363/comments","events_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/363/events","html_url":"https://github.com/yajra/laravel-datatables/issues/363","id":129554621,"number":363,"title":"Returning '0' for Primary Key when protected $primaryKey is defined","user":{"login":"gn0rt0n","id":1416754,"avatar_url":"https://avatars.githubusercontent.com/u/1416754?v=3","gravatar_id":"","url":"https://api.github.com/users/gn0rt0n","html_url":"https://github.com/gn0rt0n","followers_url":"https://api.github.com/users/gn0rt0n/followers","following_url":"https://api.github.com/users/gn0rt0n/following{/other_user}","gists_url":"https://api.github.com/users/gn0rt0n/gists{/gist_id}","starred_url":"https://api.github.com/users/gn0rt0n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gn0rt0n/subscriptions","organizations_url":"https://api.github.com/users/gn0rt0n/orgs","repos_url":"https://api.github.com/users/gn0rt0n/repos","events_url":"https://api.github.com/users/gn0rt0n/events{/privacy}","received_events_url":"https://api.github.com/users/gn0rt0n/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-28T19:35:07Z","updated_at":"2016-01-29T04:23:32Z","closed_at":null,"body":"1. Create a table such as:\r\n  ```\r\nSchema::create(\r\n            'products',\r\n            function (Blueprint $table) {\r\n                $table->string('sku', 64)->primary('products_pkey');\r\n                 $table->string('description');\r\n                $table->text('body');\r\n                $table->decimal('price', 10);\r\n                $table->timestamp('created_at')->default(DB::RAW('CURRENT_TIMESTAMP'));\r\n                $table->timestamp('updated_at')->default(DB::RAW('CURRENT_TIMESTAMP'));\r\n            }\r\n        );\r\n  ```\r\n\r\n2. Define in Product.php Class\r\n  ```\r\n protected $primaryKey = 'sku';\r\n  ```\r\n\r\n3. Setup a route for the following call:\r\n  ```\r\nRoute::get('test-products', 'ProductsController@anydata');\r\n  ```\r\n\r\n  and place the following function in the controller\r\n\r\n  ```\r\n  public function anyData()\r\n    {\r\n        return Datatables::of(Product::select('sku'))->make(true);\r\n    }\r\n  ```\r\n\r\n4. Test the route. Results will all return '0' (I have tested using plain ::query(), as well as multiple column selection)\r\n\r\n5. Comment out the following line in the class\r\n\r\n  ```\r\nprotected $primaryKey = 'sku'; \r\n  ```\r\n\r\n\r\n4. Test the route. Results will all be returned correctly\r\n\r\n\r\n\r\n```\r\nThis was tested against:\r\n* \"yajra/laravel-datatables-oracle\": \"~6.0\",\r\n* \"yajra/laravel-datatables-oracle\": \"dev-develop\",\r\n```"},"comment":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/comments/176567793","html_url":"https://github.com/yajra/laravel-datatables/issues/363#issuecomment-176567793","issue_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/363","id":176567793,"user":{"login":"yajra","id":2687997,"avatar_url":"https://avatars.githubusercontent.com/u/2687997?v=3","gravatar_id":"","url":"https://api.github.com/users/yajra","html_url":"https://github.com/yajra","followers_url":"https://api.github.com/users/yajra/followers","following_url":"https://api.github.com/users/yajra/following{/other_user}","gists_url":"https://api.github.com/users/yajra/gists{/gist_id}","starred_url":"https://api.github.com/users/yajra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yajra/subscriptions","organizations_url":"https://api.github.com/users/yajra/orgs","repos_url":"https://api.github.com/users/yajra/repos","events_url":"https://api.github.com/users/yajra/events{/privacy}","received_events_url":"https://api.github.com/users/yajra/received_events","type":"User","site_admin":false},"created_at":"2016-01-29T04:23:32Z","updated_at":"2016-01-29T04:23:32Z","body":"There might be something wrong with your js scripts? Can you paste your js please?"}}