forteirp
5 months ago
564
13
Laravel

Form select box {!!Form::select()!!} Laravel 5.8.9

Posted 5 months ago by forteirp

I having a few issues with my values not matching up and my dropdown is also giving me the values as an array...

Here's what I have in my PostsController...

public function edit(Post $post)
{
    $categories = Category::pluck('title', 'id');

    return view('posts.edit')->withPost($post)->withCategories($categories);

and here's my edit.blade...

{{ Form::label('category_id', 'Category :')}}
{!! Form::select('category_id', $categories, null, ['class' => 'form-control']) !!}

I have tried the few different ways suggested on other posts, but I'm still having these issues, "need little help"?

Here's the value issue I was talking about: enter image description here- https://i.stack.imgur.com/Ew4j2.jpg

Here's the array issue I was talking about: enter image description here- https://i.stack.imgur.com/RM5kx.jpg

Please sign in or create an account to participate in this conversation.