How to initialize DataGrid with constructor parameter
-
Hello,
I am using Customer Document extention, there is a datagrid class with a custom contstructor.
However, i do not know how to pass parameter value to this constructor.#1 DocumentController code
$customer = $this->customerRepository->with(['addresses', 'group'])->findOrFail($id);if (request()->ajax()) { return datagrid(IndividualCustomerDocumentDataGrid::class)->process(); }
#2 datagrid class
class IndividualCustomerDocumentDataGrid extends DataGrid
{
/**
* Customer Id for getting document.
*/
protected $customerId;/** * Create a new controller instance. * * @return void */ public function __construct($customerId) { $this->customerId = $customerId; }
Thank you for taking time to read this.