-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
I have a JSON field called name with keys as follows: first, last, title.
On the index page, I wish to join all into one column - the full name.
At the moment I have this code, which does not work:
Text::make('Name', function () { return $this->name->first.' '.$this->name->last; })
But this does work, which shows the title of the user:
Text::make('Name', 'name->title')
Update:
I have the following in
app/User.php
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'name' => 'json',
];
In Nova/User.php
Text::make('Name', function ()
{
return $this->name->first;
}),
Error:
Trying to get property 'first' of a non-object
I
The following returns an Object called Value and renders the 'title':
Text::make('Name', 'name->title')
The following returns an Object called Value and renders the the complete Object as a string:
Text::make('Name', 'name')
Metadata
Metadata
Assignees
Labels
No labels