public function destroy($id)
    {
        $this->authorize('browse_bread');

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

        // Delete Translations, if present
        if (is_bread_translatable($dataType)) {
            $dataType->deleteAttributeTranslations($dataType->getTranslatableAttributes());
        }

        $res = Voyager::model('DataType')->destroy($id);
        $data = $res
            ? $this->alertSuccess(__('voyager::bread.success_remove_bread', ['datatype' => $dataType->name]))
            : $this->alertError(__('voyager::bread.error_updating_bread'));
        if ($res) {
            event(new BreadDeleted($dataType, $data));
        }

        if (!is_null($dataType)) {
            Voyager::model('Permission')->removeFrom($dataType->name);
        }

        return redirect()->route('voyager.bread.index')->with($data);
    }
public function destroy($id)
    {
        $this->authorize('browse_bread');

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

        // Delete Translations, if present
        if (is_bread_translatable($dataType)) {
            $dataType->deleteAttributeTranslations($dataType->getTranslatableAttributes());
        }

        $res = Voyager::model('DataType')->destroy($id);
        $data = $res
            ? $this->alertSuccess(__('voyager::bread.success_remove_bread', ['datatype' => $dataType->name]))
            : $this->alertError(__('voyager::bread.error_updating_bread'));
        if ($res) {
            event(new BreadDeleted($dataType, $data));
        }

        if (!is_null($dataType)) {
            Voyager::model('Permission')->removeFrom($dataType->name);
        }

        return redirect()->route('voyager.bread.index')->with($data);
    }
public function destroy ( $ id ) { $ this -> authorize ( 'browse_bread' ) ; /* @var \TCG\Voyager\Models\DataType $dataType */ $ dataType = Voyager :: model ( 'DataType' ) -> find ( $ id ) ; // Delete Translations, if present if ( is_bread_translatable ( $ dataType ) ) { $ dataType -> deleteAttributeTranslations ( $ dataType -> getTranslatableAttributes ( ) ) ; } $ res = Voyager :: model ( 'DataType' ) -> destroy ( $ id ) ; $ data = $ res ? $ this -> alertSuccess ( __ ( 'voyager::bread.success_remove_bread' , [ 'datatype' => $ dataType -> name ] ) ) : $ this -> alertError ( __ ( 'voyager::bread.error_updating_bread' ) ) ; if ( $ res ) { event ( new BreadDeleted ( $ dataType , $ data ) ) ; } if ( ! is_null ( $ dataType ) ) { Voyager :: model ( 'Permission' ) -> removeFrom ( $ dataType -> name ) ; } return redirect ( ) -> route ( 'voyager.bread.index' ) -> with ( $ data ) ; }
Delete BREAD.

@param Number $id BREAD data_type id.

@return \Illuminate\Http\RedirectResponse
Delete BREAD .