Skip to content

Instantly share code, notes, and snippets.

@vaneves
Last active August 29, 2015 14:24
Show Gist options
  • Save vaneves/c6561b50c59c1bd70aa8 to your computer and use it in GitHub Desktop.
Save vaneves/c6561b50c59c1bd70aa8 to your computer and use it in GitHub Desktop.
Exemplo de select no Trilado
<?php
class Pais extends Model
{
public static function listarArray()
{
$paises = array();
foreach(self::search(1, 1000, 'Nome') as $pais)
{
$paises[$pais->Id] = $pais->Nome; //troque pelos nomes das suas colunas
}
return $paises;
}
}
<div class="minha-classe"> <!-- vai usar seu HTML -->
<div class="outra">
<label>País</label>
<?= Form::select('IdPais', Pais::listarArray(), $model->IdPais') ?> <!-- se já estiver usando BForm, use-o. Nele já está incluso a label (linha anterior e tal) -->
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment