{"action":"closed","issue":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1027","repository_url":"https://api.github.com/repos/yajra/laravel-datatables","labels_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1027/labels{/name}","comments_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1027/comments","events_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/1027/events","html_url":"https://github.com/yajra/laravel-datatables/issues/1027","id":210200345,"number":1027,"title":"filterColumn colsure never executed #question","user":{"login":"rizerzero","id":1518379,"avatar_url":"https://avatars2.githubusercontent.com/u/1518379?v=3","gravatar_id":"","url":"https://api.github.com/users/rizerzero","html_url":"https://github.com/rizerzero","followers_url":"https://api.github.com/users/rizerzero/followers","following_url":"https://api.github.com/users/rizerzero/following{/other_user}","gists_url":"https://api.github.com/users/rizerzero/gists{/gist_id}","starred_url":"https://api.github.com/users/rizerzero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rizerzero/subscriptions","organizations_url":"https://api.github.com/users/rizerzero/orgs","repos_url":"https://api.github.com/users/rizerzero/repos","events_url":"https://api.github.com/users/rizerzero/events{/privacy}","received_events_url":"https://api.github.com/users/rizerzero/received_events","type":"User","site_admin":false},"labels":[{"id":67904193,"url":"https://api.github.com/repos/yajra/laravel-datatables/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-25T01:42:03Z","updated_at":"2017-07-06T01:07:51Z","closed_at":"2017-07-06T01:07:51Z","body":"## Can't make the filterClumn work \r\n\r\n<!-- Please describe your problem/feature request here. -->\r\ni want to add a custom filter, i added the HTML and the java-script event that trigger the draw method on change , it works fine but in the php side i can't make it work , i get the value of my input but the filterColumn does not work  \r\n ```php \r\nreturn Datatables::eloquent($model)\r\n                ->filterColumn('category', function($query, $keyword) {\r\n               //no matter what i white here , the code is never executed  , the filterColumn method ( in the        baseEngine ) is called but never runs what i put here \r\n                                    $sql=$query->where('category', '=', $request->get('category'));\r\n                    $query->whereRaw($sql, [\"%{$keyword}%\"]);\r\n                })\r\n                ->make();\r\n});\r\n```\r\n### if i take the query code outside like so the filter works \r\n ```php \r\n\r\n $query= User::all();\r\n$dt = Datatables::eloquent($model);\r\n                \r\n        $query->where('category', '=', $request->get('category'));\r\n             \r\n        return $dt->make();\r\n```\r\n\r\nthe thing that i don't understand is how does this method work\r\n```php\r\n\r\n public function filterColumn($column, $method)\r\n    {\r\n        $params                             = func_get_args();\r\n        $this->columnDef['filter'][$column] = ['method' => $method, 'parameters' => array_splice($params, 2)];\r\n  \r\n       return $this;\r\n    }\r\n```\r\n\r\n#how does the call work , how does the code bring the $query, \r\n\r\n```php\r\nfilterColumn('category', function($query, $keyword) {\r\n}\r\n```\r\n**_i know  it's just closures but i feel i'm missing something to understand how it all works , and i would love to know and be a better developer_** \r\n**Thank you !**\r\n \r\n- windows 10\r\n- Operating System\r\n- PHP 5.6.16\r\n- Laravel 5.3\r\n- Laravel-Datatables 6.0"}}
{"actor":{"display_login":"yajra"}}