app/Http/Controllers/Dashboard/CategoryController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Category  $category
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, Category $category)
    {
        $rules = [];
        foreach (config('translatable.locales') as $locale) {
            $rules += [$locale . '.name' => ['required', Rule::unique('category_translations', 'name')->ignore($category->id, 'category_id')]];
            $rules += [$locale . '.description' => ['required', Rule::unique('category_translations', 'description')->ignore($category->id, 'category_id')]];
        }
        $request->validate($rules);
        $category->update($request->all());
        session()->flash('success',__('site.update_successfully'));
        return redirect()->route('dashboard.categories.index');
    }
public function update ( Request $ request , Category $ category ) { $ rules = [ ] ; foreach ( config ( 'translatable.locales' ) as $ locale ) { $ rules += [ $ locale . '.name' => [ 'required' , Rule :: unique ( 'category_translations' , 'name' ) -> ignore ( $ category -> id , 'category_id' ) ] ] ; $ rules += [ $ locale . '.description' => [ 'required' , Rule :: unique ( 'category_translations' , 'description' ) -> ignore ( $ category -> id , 'category_id' ) ] ] ; } $ request -> validate ( $ rules ) ; $ category -> update ( $ request -> all ( ) ) ; session ( ) -> flash ( 'success' , __ ( 'site.update_successfully' ) ) ; return redirect ( ) -> route ( 'dashboard.categories.index' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .