Skip to content

Instantly share code, notes, and snippets.

@nasirkhan
Last active October 1, 2016 07:00
Show Gist options
  • Select an option

  • Save nasirkhan/ca73c2d50c0e0de4d0176ef4541ce819 to your computer and use it in GitHub Desktop.

Select an option

Save nasirkhan/ca73c2d50c0e0de4d0176ef4541ce819 to your computer and use it in GitHub Desktop.
Show Name and Code as Text using Laravel Lists method
<?php
// Show Name and Code as Text using Laravel Lists method,
// this array of data will be passed as value to prepate HTML Select Dropdown
$institutes = Institute::select(DB::raw("CONCAT(name,' (', code, ')') AS text, id"))->lists('text', 'id')->take(5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment