2
Consider that my table in DB has many columns. However, for a specific query I do not need all of them. As I would in Laravel ( using both Eloquent and Querybuilder to pick up only the columns I need?
2
Consider that my table in DB has many columns. However, for a specific query I do not need all of them. As I would in Laravel ( using both Eloquent and Querybuilder to pick up only the columns I need?
4
To set the columns you want to select use select:
DB::table('nome_da_tabela')->select('coluna1', 'coluna2')->get();
As found in the documentation.
Browser other questions tagged laravel laravel-5
You are not signed in. Login or sign up in order to post.
Set descrica_da_column? "name, age, email" for example.
– Cesar de Barros
That’s ai! DB::table('users')->select('name','email')->get();
– Evert
Any idea what I’d look like using Eloquent?
– Cesar de Barros
@Cesardebarros in the same way... User::select('name','email')->get();
– Evert