{"action":"closed","issue":{"url":"https://api.github.com/repos/yajra/laravel-datatables/issues/970","repository_url":"https://api.github.com/repos/yajra/laravel-datatables","labels_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/970/labels{/name}","comments_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/970/comments","events_url":"https://api.github.com/repos/yajra/laravel-datatables/issues/970/events","html_url":"https://github.com/yajra/laravel-datatables/issues/970","id":205080446,"number":970,"title":"How to filter a concatenated result value in multi fields in Laravel 5.3 ","user":{"login":"phpnets","id":7867140,"avatar_url":"https://avatars.githubusercontent.com/u/7867140?v=3","gravatar_id":"","url":"https://api.github.com/users/phpnets","html_url":"https://github.com/phpnets","followers_url":"https://api.github.com/users/phpnets/followers","following_url":"https://api.github.com/users/phpnets/following{/other_user}","gists_url":"https://api.github.com/users/phpnets/gists{/gist_id}","starred_url":"https://api.github.com/users/phpnets/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phpnets/subscriptions","organizations_url":"https://api.github.com/users/phpnets/orgs","repos_url":"https://api.github.com/users/phpnets/repos","events_url":"https://api.github.com/users/phpnets/events{/privacy}","received_events_url":"https://api.github.com/users/phpnets/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":3,"created_at":"2017-02-03T06:14:19Z","updated_at":"2017-02-04T05:32:11Z","closed_at":"2017-02-04T05:32:11Z","body":"Hi,\r\n\r\nIn my datatable, I'm retrieving the name field as CONCAT(fname,\" \", \"lname\").  I have to search name field in the datatable and it should return matching with either fname or lname. Please let me know how to do this:\r\n\r\n\r\n\r\n**js code:**\r\n\r\n```\r\ncolumns  : [\r\n   \t\t\t { data: 'name', name: 'fname' }, //I have tried this also : ['fname','lname' ]\r\n                --------------------\r\n```\r\n\r\n**PHP code:**\r\n\r\n```\r\n$users = User::leftJoin('address', 'address.user_id', '=', 'users.user_id') \r\n                    ->select([\\DB::Raw(\r\n                        'CONCAT(fname,\" \",lname) as name, CONCAT(country_code, \"\", mobile_number) as mobile_num, IF(status = 1, \"Active\", \"Inactive\") as status,\r\n                        (SELECT count(subscription_id) FROM subscription WHERE subscription.user_id = users.user_id AND subscription.status IN (2,4)) as totalActivesubscription'\r\n\r\n                        ), 'gender', 'city as address', 'city','users.user_id', 'email_id'])\r\n\r\n                    ->where('users.role_id', '=', $aParam['role_id']);\r\n\r\n            return Datatables::of($users)\r\n                ->addColumn('actions', function ($users) {\r\n                    return view('users.templates.user_action', [\r\n                        'user' => $users\r\n                        ])->render();\r\n                })\r\n            \r\n\r\n            ->make(true);\r\n\r\n```\r\nSystem details:\" \r\n- Operating System : Windows8, Linux\r\n- PHP Version : 5.6\r\n- Laravel Version : 5.3\r\n- Laravel-Datatables Version : latest\r\n"}}
{"actor":{"display_login":"phpnets"}}