Last active
August 29, 2015 14:24
-
-
Save vaneves/c6561b50c59c1bd70aa8 to your computer and use it in GitHub Desktop.
Exemplo de select no Trilado
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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