Home Laravel How to select concatenate columns with Laravel Query Builder?

How to select concatenate columns with Laravel Query Builder?

by Shahriar Sagor
select concatenate columns

Today now in this post i wills how you how to select concatenate columns with Laravel Query Builder? We are always need to use sql query for concatenate full name or something to concatenate by using mysql concatenate function, now if we think how to use concatenate function in laravel query builder then now this post will help you.

So, if we need to use concatenate mysql function then you can see bellow example:

Example:

$user = User::select("users.*",DB::raw("CONCAT(users.first_name,'',users.last_name) as full_name"))
->get();
print_r($user);

Read Also : How to convert Object into Array in PHP?

Thanks for read. I hope it help you. For more you can follow us on facebook.

close

You may also like