LoginSignup
4
4

More than 5 years have passed since last update.

FuelPHP で Orm\Model::find('all') の結果をセレクトボックスで表示する

Last updated at Posted at 2015-04-13

Arr::pluck を使う

Model_Optionid, label プロパティを持っているとする。

$options = Model_Option::find('all');

echo Form::select('option_id', null, Arr::pluck($options , 'lable', 'id'));

出力結果

<select name="option_id" id="form_option_id">
    <option value="1">オプション1</option>
    <option value="2">オプション2</option>
</select>
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4