I have an Eloquent model (Presenters) that has three columns: id
, first_name
and last_name
. What I want to do is populate the select opti
You've provided the answer, look at the PaulDM reply
Just adapt it, hope it works for you:
// your eloquent model ...
public static function listPresenters() {
$ret = [];
foreach (self::all() as $presenter) {
$ret[$presenter->id] = "{$presenter->first_name} {$presenter->last_name}";
}
return $ret;
}
// your eloquent model ...