How to select concat columns with Laravel Query Builder?

By Hardik Savani | April 30, 2016 | | 78984 Viewer | Category : Laravel


We are always wanted to use sql query for concatenate fullname or something to concat using mysql concat function, now if you think how to use concat function in laravel query builder then this post can help you. So, if you need to use concat mysql function then see bellow example:

Example:

$user = User::select("users.*"

,DB::raw("CONCAT(users.first_name,' ',users.last_name) as full_name"))

->get();

print_r($user);




Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
Follow Me: Github Twitter
***Do you want me hire for your Project Work? Then Contact US.