{"action":"created","issue":{"url":"https://api.github.com/repos/orchestral/html/issues/39","labels_url":"https://api.github.com/repos/orchestral/html/issues/39/labels{/name}","comments_url":"https://api.github.com/repos/orchestral/html/issues/39/comments","events_url":"https://api.github.com/repos/orchestral/html/issues/39/events","html_url":"https://github.com/orchestral/html/issues/39","id":99721369,"number":39,"title":"[5.1] Sorting by an non-existent column causes exception","user":{"login":"stevebauman","id":6421846,"avatar_url":"https://avatars.githubusercontent.com/u/6421846?v=3","gravatar_id":"","url":"https://api.github.com/users/stevebauman","html_url":"https://github.com/stevebauman","followers_url":"https://api.github.com/users/stevebauman/followers","following_url":"https://api.github.com/users/stevebauman/following{/other_user}","gists_url":"https://api.github.com/users/stevebauman/gists{/gist_id}","starred_url":"https://api.github.com/users/stevebauman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevebauman/subscriptions","organizations_url":"https://api.github.com/users/stevebauman/orgs","repos_url":"https://api.github.com/users/stevebauman/repos","events_url":"https://api.github.com/users/stevebauman/events{/privacy}","received_events_url":"https://api.github.com/users/stevebauman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-07T20:02:45Z","updated_at":"2015-08-08T01:54:50Z","closed_at":null,"body":"Calling sortable on a `TableGrid` instance, then entering in a url such as `admin/users?order_by=test` causes `PDOException`\r\n\r\n    SQLSTATE[42S22]: Column not found: 1054 Unknown column 'test' in 'order clause'\r\n\r\nMaybe we could just check if the column exists in the models database table before trying to run the `orderBy()` method? Or maybe check if the column exists as an attribute in the model?"},"comment":{"url":"https://api.github.com/repos/orchestral/html/issues/comments/128880888","html_url":"https://github.com/orchestral/html/issues/39#issuecomment-128880888","issue_url":"https://api.github.com/repos/orchestral/html/issues/39","id":128880888,"user":{"login":"crynobone","id":172966,"avatar_url":"https://avatars.githubusercontent.com/u/172966?v=3","gravatar_id":"","url":"https://api.github.com/users/crynobone","html_url":"https://github.com/crynobone","followers_url":"https://api.github.com/users/crynobone/followers","following_url":"https://api.github.com/users/crynobone/following{/other_user}","gists_url":"https://api.github.com/users/crynobone/gists{/gist_id}","starred_url":"https://api.github.com/users/crynobone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crynobone/subscriptions","organizations_url":"https://api.github.com/users/crynobone/orgs","repos_url":"https://api.github.com/users/crynobone/repos","events_url":"https://api.github.com/users/crynobone/events{/privacy}","received_events_url":"https://api.github.com/users/crynobone/received_events","type":"User","site_admin":false},"created_at":"2015-08-08T01:54:50Z","updated_at":"2015-08-08T01:54:50Z","body":"A simple solution is to just the first parameter.\r\n\r\n```\r\n$table->sortable(['only' => ['username', 'email']);\r\n```\r\n\r\nChecking if the column exists in the models would be possible, but we also support basic fluent query, can we handle both scenario? If so, it should be done in <https://github.com/orchestral/support/blob/master/src/Support/Traits/QueryFilterTrait.php#L16>"}}