私はlaravel backを使用しており、bundlesとstudyという2つのテーブルがあります。bundleCrudController のフォームにドロップダウン フィールドを追加しました。しかし、調査テーブルのすべてのデータではなく、ログインしたユーザーによって作成された調査の値のみをドロップダウンリストに追加したいだけです。
ドロップダウンリストにデータを追加するコードは次のとおりです-
$this->crud->addField([
'name' => 'studies',
'label' => 'Studies',
'type' => 'select2_from_array',
'options' => $this->Study->getUnallocatedStudies($entryId),
'allows_null' => false,
'hint' => 'Search for the studies you would like to add to this bundle',
'tab' => 'Info',
'allows_multiple' => true
]);
$this->crud->addColumn([
'label' => 'Studies',
'type' => "select_multiple",
'name' => 'bundle_id',
'entity' => 'studies',
'attribute' => 'name',
'model' => "App\Models\Study",
]);
したがって、すべてのレコードではなく、ログインしたユーザーによって作成されたドロップダウンリストにそれらのレコードのみを追加するという問題を解決するのに役立ちます..ありがとう