-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
How do I add a new method to Encore\Admin\Grid\Column ? #5860
Comments
Maybe you can inherit the Column class, add new method which you need in the new class, and then adopt it in your view? I had use the way to create new Authenticate way to integrate the authentication with other way. It works. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
I am trying to add a new column filter. To achieve this, I need to place a new method similar to "filter" that exists in "Encore\Admin\Grid\Column". Since this is part of a vendor package, I cannot edit it directly. Therefore, my plan is to rewrite this vendor class. I tried using the following code in "AdminServiceProvider". This is a new ServiceProvider I added under config/app.php to make this change.
public function boot() { Admin::booting(function () { $this->app->singleton(\Encore\Admin\Grid\Column::class, \App\Admin\Extensions\Override\Grid\Column::class); }); }
Here my try is to rewrite vendor class method "filter"
`<?php
namespace App\Admin\Extensions\Override\Grid;
use Encore\Admin\Grid\Column as OriginalColumn;
class Column extends OriginalColumn
{
/**
* Set column filter.
*
* @param mixed|null $builder
*
* @return $this
*/
public function filter($builder = null)
{
dd('sss');
return $this->addFilter(...func_get_args());
}
}`
I do not see this change reflected. Could someone help me with rewriting this vendor class?
The text was updated successfully, but these errors were encountered: