public function sortCategories(Request $request)
    {
        $this->validate(
            $request,
            [
                'categories' => 'required|array',
            ]
        );

        foreach ($request->input('categories') as $category_id => $sort) {
            $category = Category::find($category_id);

            $category->sort = $sort;

            $category->save();
        }

        return redirect()->back()->withStatus(trans('mustard::admin.categories_sorted'));
    }
public function sortCategories(Request $request)
    {
        $this->validate(
            $request,
            [
                'categories' => 'required|array',
            ]
        );

        foreach ($request->input('categories') as $category_id => $sort) {
            $category = Category::find($category_id);

            $category->sort = $sort;

            $category->save();
        }

        return redirect()->back()->withStatus(trans('mustard::admin.categories_sorted'));
    }
public function sortCategories ( Request $ request ) { $ this -> validate ( $ request , [ 'categories' => 'required|array' , ] ) ; foreach ( $ request -> input ( 'categories' ) as $ category_id => $ sort ) { $ category = Category :: find ( $ category_id ) ; $ category -> sort = $ sort ; $ category -> save ( ) ; } return redirect ( ) -> back ( ) -> withStatus ( trans ( 'mustard::admin.categories_sorted' ) ) ; }
Sort categories.

@return \Illuminate\Http\RedirectResponse
Sort categories .