vendredi 18 mars 2016

Specifying columns when using load method in Laravel?

Is it possible to specify certain columns when using the LOAD method in Laravel since I don't want all columns to be selected.

Let's say I have this:

$usersWithDepartments = User::with('department')->get();

Is this possible?

$usersWithDepartments = $usersWithDepartments->load('equipment', function($query)
{
    $query->select('table_equipment.name');
})

I've tried using the select method after the load method but it says "select method does not exists"

Work arounds?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire