public function update(Request $request, $id)
    {
        $this->authorize('browse_bread');

        /* @var \TCG\Voyager\Models\DataType $dataType */
        try {
            $dataType = Voyager::model('DataType')->find($id);

            // Prepare Translations and Transform data
            $translations = is_bread_translatable($dataType)
                ? $dataType->prepareTranslations($request)
                : [];

            $res = $dataType->updateDataType($request->all(), true);
            $data = $res
                ? $this->alertSuccess(__('voyager::bread.success_update_bread', ['datatype' => $dataType->name]))
                : $this->alertError(__('voyager::bread.error_updating_bread'));
            if ($res) {
                event(new BreadUpdated($dataType, $data));
            }

            // Save translations if applied
            $dataType->saveTranslations($translations);

            return redirect()->route('voyager.bread.index')->with($data);
        } catch (Exception $e) {
            return back()->with($this->alertException($e, __('voyager::generic.update_failed')));
        }
    }
public function update(Request $request, $id)
    {
        $this->authorize('browse_bread');

        /* @var \TCG\Voyager\Models\DataType $dataType */
        try {
            $dataType = Voyager::model('DataType')->find($id);

            // Prepare Translations and Transform data
            $translations = is_bread_translatable($dataType)
                ? $dataType->prepareTranslations($request)
                : [];

            $res = $dataType->updateDataType($request->all(), true);
            $data = $res
                ? $this->alertSuccess(__('voyager::bread.success_update_bread', ['datatype' => $dataType->name]))
                : $this->alertError(__('voyager::bread.error_updating_bread'));
            if ($res) {
                event(new BreadUpdated($dataType, $data));
            }

            // Save translations if applied
            $dataType->saveTranslations($translations);

            return redirect()->route('voyager.bread.index')->with($data);
        } catch (Exception $e) {
            return back()->with($this->alertException($e, __('voyager::generic.update_failed')));
        }
    }
public function update ( Request $ request , $ id ) { $ this -> authorize ( 'browse_bread' ) ; /* @var \TCG\Voyager\Models\DataType $dataType */ try { $ dataType = Voyager :: model ( 'DataType' ) -> find ( $ id ) ; // Prepare Translations and Transform data $ translations = is_bread_translatable ( $ dataType ) ? $ dataType -> prepareTranslations ( $ request ) : [ ] ; $ res = $ dataType -> updateDataType ( $ request -> all ( ) , true ) ; $ data = $ res ? $ this -> alertSuccess ( __ ( 'voyager::bread.success_update_bread' , [ 'datatype' => $ dataType -> name ] ) ) : $ this -> alertError ( __ ( 'voyager::bread.error_updating_bread' ) ) ; if ( $ res ) { event ( new BreadUpdated ( $ dataType , $ data ) ) ; } // Save translations if applied $ dataType -> saveTranslations ( $ translations ) ; return redirect ( ) -> route ( 'voyager.bread.index' ) -> with ( $ data ) ; } catch ( Exception $ e ) { return back ( ) -> with ( $ this -> alertException ( $ e , __ ( 'voyager::generic.update_failed' ) ) ) ; } }
Update BREAD.

@param \Illuminate\Http\Request $request
@param number                   $id

@return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
Update BREAD .