Catch specific columns with Laravel querybuilder

2

Consider that my table in the DB has many columns. But for a specific query I do not need all of them.  How would I do it in Laravel (using both Eloquent and QueryBuilder to get just the columns I need?

    
asked by anonymous 28.03.2016 / 14:51

1 answer

4

To define the columns you want to select use select :

DB::table('nome_da_tabela')->select('coluna1', 'coluna2')->get();

As you'll find in the documentation .

    
28.03.2016 / 15:58