Я пытаюсь динамически заполнить флажки функциональностью привязки модели формы в Laravel / Blade.
По некоторым причинам он не работает с моими флажками, он работает для всех других полей.
Моя форма:
{{ Form::model($imagerequest, array('route' => array('imagerequests.update', $imagerequest->id), 'method' => 'PUT', 'files' => true)) }}
@foreach($requestTypes as $requestType)
{{ Form::checkbox('request_type_ids[]', $requestType->id) }}
{{ Form::label($requestType->type, $requestType->type) }}
<br>
@endforeach
{{ Form::close() }}
Моя модель ImageRequest и модель RequestType имеют следующее соотношение:
ImageRequest Model
public function requestTypes()
{
return $this->belongsToMany('App\RequestType');
}
В моей модели RequestType у меня есть этот re
RequestType Model
public function imageRequests()
{
return $this->hasMany('App\ImageRequest');
}
Может, это причина того, что привязка модели формы не работает?
Возможно ли, что я здесь пытаюсь?