:だから私はmacros.phpをcheckt :配列型でなければなりません、オブジェクトを指定して
Argument 2 passed to Collective\Html\HtmlBuilder::{closure}() must be of the type array, object given ... macros.php', '92', array('items' => object(Collection)))
/**
* Render Dropdown Options
*/
HTML::macro('dropdownOptions', function(Collection $items, array selected, $withEmpty = true, $render = false)
{
$options = null;
/* jQuery Plugin 'choosen' needs an empty option as
* default selection */
if ($withEmpty)
{
$options = '<option></option>';
}
$items->each(function($item) use(&$options, $selected)
{
$options .= sprintf('<option %s value="%s">%s</option>',
(in_array($item->id, $selected)) ? 'selected="selected"' : '',
$item->id,
$item->name
);
});
if ($render)
{
echo $options;
}
return $options;
});
そして、私のヘルパーファイル:
use HTML;
use Illuminate\Database\Eloquent\Model;
class DropdownHelper
{
public static function getOptions($type, $selected = array())
{
return HTML::dropdownOptions(self::get(new $type), $selected);
}
public static function getGroupedOptions($type, $selected = array(), $childPropertyName = 'services')
{
return HTML::groupedDropdownOptions(self::get(new $type), $selected, $childPropertyName);
}
protected static function get(Model $model)
{
return $model::all();
}
}
しかし、私はそれを得ることはありません、私はまた、composer.jsonとプロバイダを確認エイリアス。すべて私のために良い見えます。なぜこのエラーが出るのですか?
DropdownHelper :: GETOPTIONS:
$view
->with('optionsSalutation', DropdownHelper::getOptions(
DropdownEntityEnum::Salutations, $view->selectedOptionSalutation))
->nest('profileImageSection', 'customer.partials.profileimage', array('image' => $view->image));
UserProfileController:
$data = array_merge(Auth::user()->profile->toArray(), array(
'view' => 'customer.account.profile.private',
'type' => Auth::user()->getTypeId(),
'selectedOptionSalutation' => [Auth::user()->profile->getSalutationId()],
'image' => Auth::user()->profile->image,
'has_newsletter' => Auth::user()->getHasNewsletter()
));
'$ view-> selectedOptionSalutation'には何が割り当てられていますか? – patricus