Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.0] HTML Entities in method addColum() ? #985

Closed
dinhquochan opened this issue Feb 6, 2017 · 2 comments
Closed

[7.0] HTML Entities in method addColum() ? #985

dinhquochan opened this issue Feb 6, 2017 · 2 comments

Comments

@dinhquochan
Copy link

dinhquochan commented Feb 6, 2017

In controller:

class IndexController extends Controller {
    public function index() {
        return Datatables::eloquent(
            Menu::query()
        )
            ->addColumn('build', function ($model) {
                if(access()->can('admin.menu.build')) {
                   // this function generation buttton
                    return button_display('link', __('menu.builder'), 'fa fa-gear',[
                        'href' => route('admin.menu.item.index', $model->id)
                    ]);
                }
            })
            ->addColumn('action', function($model) {
                $buffer = '';

                if(access()->can('admin.menu.edit')) {
                   // Same function extends `button_display`
                    $buffer .= edit_button(route('admin.menu.edit', $model->id));
                }

                if(access()->can('admin.menu.delete')) {
                    $buffer .= delete_button(route('admin.menu.destroy', $model->id));
                }

                return $buffer;
            })
            ->make(true);
    }
}

But i recivice JSON:

screenshot_1

Same function but 1 column not encode, 1 column encode ?

@yajra
Copy link
Owner

yajra commented Feb 7, 2017

There was breaking change on v7. See upgrade guide and issue #949 for details. Thanks!

@yajra yajra changed the title Bug: HTML Entities in method addColum() ? [7.0] HTML Entities in method addColum() ? Feb 7, 2017
@yajra
Copy link
Owner

yajra commented Feb 7, 2017

BTW, action column is allowed as raw column by default which explains why you got those output.

@yajra yajra closed this as completed Feb 7, 2017
@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants