app/Http/Controllers/Backend/BackendCategoryController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(Request $request, $id)
    {
         Set some rules, I Set here because are only few rows
        $this->validate( $request, [
            'name' => 'required|max:250',
            'parent_id' => 'required|numeric|min:0',
        ]);
        Recovery input data
        $input_data = $request->all();
        $category = $this->categories->find($id);
        if ($category->update($input_data)) {
            $category->seo()->update(['title_tag'=>$input_data['title_tag'], 'description_tag'=>$input_data['description_tag']]);
            \Session::flash('flash_message_success', 'Success! Entry updated.');
        }else{
            \Session::flash('flash_message_error', 'Error! Entry Not updated.');
        }
        return redirect()->route('categories.edit', $id);
    }
public function update ( Request $ request , $ id ) { $ this -> validate ( $ request , [ 'name' => 'required|max:250' , 'parent_id' => 'required|numeric|min:0' , ] ) ; $ input_data = $ request -> all ( ) ; $ category = $ this -> categories -> find ( $ id ) ; if ( $ category -> update ( $ input_data ) ) { $ category -> seo ( ) -> update ( [ 'title_tag' => $ input_data [ 'title_tag' ] , 'description_tag' => $ input_data [ 'description_tag' ] ] ) ; \ Session :: flash ( 'flash_message_success' , 'Success! Entry updated.' ) ; } else { \ Session :: flash ( 'flash_message_error' , 'Error! Entry Not updated.' ) ; } return redirect ( ) -> route ( 'categories.edit' , $ id ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
// // Set some rules, I Set here because are only few rows //Recovery input data