[Solved] How to update array in laravel


public function edit(Filter $filter)
{
    $colors = Color::all();

    $categories = Category::lists();

    $filters = Filter::with('category')->whereHas('category', function($query) use ($filter){

        $query->whereIn('category_id', [$filter->category_id]);

    })->get(); // I'm not sure what do you want by this instead of $filter->load('category');

    return view('Admin.filters.edit', compact('categories', 'colors', 'filter', 'filters'));
}

public function update(Request $request, $id)
{
    dd('ok');
}

Blade File

<form method="post" action="{{ route('filters.update', $filter->id) }}">
    @method('PUT')
    @csrf

Isn’t it you’re looking for?

solved How to update array in laravel