phplaraveleloquentlaravel-3

Laravel how to Query Rows by Column in Eloquent


In Laravel, I can get the rows from a selected column in MySQL by a Laravel query.

$data = DB::query('select engagements from csv2');

However, I wonder how can I write this using Eloquent?


Solution

  • $data = Model::get(array('engagements'));
    

    For example if I only want to get the E-mail for a user;

    $email = User::get(array('email'));