In controller when i try to send multiple value to view such as this codes:
$content = Contents::find($contents);
$content_categories['categories'] = ContentCategories::all()->pluck('title', 'id');
$selected_categories['selected_categories'] = $content->categories()->pluck('title', 'id');
return view('layouts.backend.pages.manage_contents.edit', compact($selected_categories, $content_categories, ['content' => $content]));
i get error for this variables into view:
$categories
$selected_categories
$content
result of dd(['content' => $content], $content_categories, $selected_categories); is:
array:1 [▼
"content" => Contents {#220 ▶}
]
array:1 [▼
"categories" => Collection {#214 ▶}
]
array:1 [▼
"selected_categories" => Collection {#227 ▶}
]
whats problem of my code to parse them on view or send them with correct way
my view:
1) {{ Form::select('categories[]', $categories, $selected_categories, array('class' => 'multiselect-success','multiple'=>'multiple')) }}
2) action="{{ route('manage_contents.update' , ['id' => $content->id ]) }}"
Errors:
"Undefined variable: categories (View: /Applications/XAMPP/xamppfiles/htdocs/alachiqServer/resources/views/layouts/backend/pages/manage_contents/edit.blade.php)"
"Undefined variable: selected_categories (View: /Applications/XAMPP/xamppfiles/htdocs/alachiqServer/resources/views/layouts/backend/pages/manage_contents/edit.blade.php)"
"Undefined variable: content (View: /Applications/XAMPP/xamppfiles/htdocs/alachiqServer/resources/views/layouts/backend/pages/manage_contents/edit.blade.php)"