Voyager
Home
Github
Issues
Search…
1.5
Introduction
Getting started
What is Voyager
Prerequisites
Installation
Upgrading
Configurations
BREAD
Introduction
Relationships
Formfields
Core concepts
Routing
Media Manager
Menus and Menu Builder
Database Manager
Settings
Compass
Roles and Permissions
Helper methods
Multilanguage
Customization
Overriding files
Overriding Routes
Additional CSS and JS
Enabling Soft-Delete
Custom relationship attributes
Adding custom Formfields
Coordinates
BREAD accessors
Custom guard
Action buttons
Troubleshooting
Using HTTPS on yours site
Missing required parameter
Powered By
GitBook
Custom relationship attributes
With Voyager 1.1 you are able to define additional attributes which you can show in a relationship.
For example a
Post
has an
Author
and you want to display the
Users
full-name. To do so, we first need to
define an Accessor
​
1
public
function
getFullNameAttribute
()
2
{
3
return
"
{
$this
->
first_name
}
{
$this
->
last_name
}
"
;
4
}
Copied!
After that we need to tell Voyager that there is an accessor we want to use:
1
public
$additional_attributes
=
[
'full_name'
];
Copied!
Thats it! You can now select
full_name
in your Relationship.
Customization - Previous
Enabling Soft-Delete
Next - Customization
Adding custom Formfields
Last modified
6mo ago
Export as PDF
Copy link