Modify the views because users table is modified
Closed this issue · 1 comments
shanke-pvex commented
I have removed the name column from users table and added firstname and lastname to the table.
So the views always show guest user.
i have published the views to my resources and adjusted to my new column names.
But the published views are not returned by the controller.
How can i achieve this?
milwad-dev commented
You can make a new attribute for the User
model to display the correct name:
protected function name(): Attribute
{
return Attribute::make(
get: fn($value, array $attributes) => $this->first_name . ' ' . $this->last_name,
set: fn($value) => $value,
);
}
But, if you think can do better in this subject, you can create PR or give your suggestion.
I welcome that 👍