// Method to get a dropdown, called by a foreign model.
public static function dropdown()
{
// so we can cache the results
static $dropdown = array();
// get the data if needed
if (empty($dropdown))
{
$dropdown = \DB::select(static::$keyfield, static::$datafield)->
from(static::table())->
execute()->
as_array(static::$keyfield, static::$datafield);
empty($dropdown) and $dropdown = array();
}
return $dropdown;
}
It looks like you're new here. If you want to get involved, click one of these buttons!