laravel - add to select box values from multiple model attribute -


i want dynamically set options select box model in laravel. want similar this:

$handymans = handyman::lists('firstname', 'handyman_id'); 

but, add select box firstname's of handymans. how can add lastname option value, shown user? ( not firstname ). try this:

$handymans = handyman::lists('firstname', 'lastname','handyman_id'); 

but doesnt work :( .

you values through mutator in class, appending full_name attribute model, this:

protected $appends = ['full_name'];  ...  public function getfullnameattribute() {     return $this->firstname.' '.$this->lastname; } 

then try list it, calling way:

$handymans = handyman::all()->lists('full_name', 'handyman_id'); 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -