-
Hi, I feel like missing something from DataTables v1 to v2. I have upgraded my Laravel 9 project from Datatables v1 to v2. And I had a custom Column with a tooltip method like this:
I was accessing my item column used as tooltip with data_get (Laravel Helper). This was working before but now I had realized that $row is returning a collection of my Model, i'm using public function builder(), not the single item. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Can you expand slightly, share your builder() method, and what is being returned by $row please :) Column::make('End Date', 'end_date')->format(fn($value, $row, Column $column) => dd($row)) Would return a single Model for that row (complete with any defined/included related model fields etc) |
Beta Was this translation helpful? Give feedback.
-
All right, I'm getting what's my problem. I have a builder method like:
I realized the problem is that $row just got the attributes I have defined in my columns method. I really don't know where I found before it wasn't an element. Sorry for the mistake. Now I'm trying to solve this without using some Model::find('id')->relation->field. It's there anyway to attach more elements? I set $this->setEagerLoadAllRelationsEnabled(); but no solution. I just got the five columns as attributes in my $row. More info. If I try this on my columns:
the $row->resolutiontype->name said I'm trying to access name on null relation. |
Beta Was this translation helpful? Give feedback.
Yes I'm on v2.
This is resolutiontype relation at Resolution model.
Finally I was able to make it work doing what you suggest.
And then in my column reference with:
This was working before. Thanks.