You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am absolutely confident with this package, on the other hand, I would like to display revisions in Laravel Nova dashboard v4.0.
I am doing this for now:
class Product extends Resource {
public function fields()
{
return [
new Panel('Revisions', [
MorphMany::make('Revisions', 'revisionHistory', \App\Nova\Revision::class),
]),
]
}
}
I have Revision resource as well:
class Revision extends Resource
{
/**
* The model the resource corresponds to.
*
* @var string
*/
public static $model = \Venturecraft\Revisionable\Revision::class;
/**
* The single value that should be used to represent the resource when being displayed.
*
* @var string
*/
public static $title = 'id';
/**
* The columns that should be searched.
*
* @var array
*/
public static $search = [
'id',
];
/**
* Hide from navigation menu
*
* @var bool
*/
public static $displayInNavigation = false;
/**
* Get the fields displayed by the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function fields(NovaRequest $request)
{
return [
MorphOne::make('Actor', 'userResponsible', \App\Nova\User::class),
Text::make('Field', 'key'),
Text::make('Old Value', 'old_value'),
Text::make('New Value', 'new_value')
];
}
// opt-out code
All works fine except userResponsible attribute, which resolves to a model \App\Models\User after requesting revisionHistory . How can I display User in my nova Resource?
An image to demonstrate the current display:
The text was updated successfully, but these errors were encountered:
@anditsung Yes, and that's what I did. I extended the Revision model and defined a user relation. Now, I am able to display the user in revisions table.
I am absolutely confident with this package, on the other hand, I would like to display revisions in Laravel Nova dashboard v4.0.
I am doing this for now:
I have
Revision
resource as well:All works fine except
userResponsible
attribute, which resolves to a model\App\Models\User
after requestingrevisionHistory
. How can I displayUser
in my nova Resource?An image to demonstrate the current display:
The text was updated successfully, but these errors were encountered: