Crud: Error on relationship or select columns with custom attribute as value

Created on 12 May 2020  路  3Comments  路  Source: Laravel-Backpack/CRUD

Bug report

What I did

Try to use a combined attribute as select or relationship column value

Example :

// MyCrudController.php
$this->crud->addColumn([
    'name' => 'customer',
    'type' => 'relationship',
    'label' => 'Customer Full Name',
    'attribute' => 'full_name',
]);

// Customer.php
public function getFullNameAttribute(): string
{
    return sprintf('%s %s', $this->first_name, $$this->last_name);
}

What I expected to happen

Show me the value :)

What happened

Throwed an error :(

What I've already tried to fix it

Add my custom combined attribute in the $append entitie's property.

// Customer.php
protected $appends = [
    'full_name',
];

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

### PHP VERSION:
PHP 7.3.13 (cli) (built: Dec 18 2019 16:08:06) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.13, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.13, Copyright (c) 1999-2018, by Zend Technologies

### LARAVEL VERSION:
v6.18.13@39519d03237a81380e2126d667e898e2922db444

### BACKPACK VERSION:
4.1.2@7084182b38bff6b19624788ff143bb249ecdc758
triage

Most helpful comment

Hello @bastos71

Sorry for introducing this change without documenting it. Well, i missed it, that's why it's not documented :disappointed:

It's related to #2810

I'v fixed it with #2815

So I am going to close this.

Thanks for report :)

All 3 comments

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps _a lot_ in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

  • Bug Reports, Feature Requests - Github Issues (here);
  • Quick help (_How do I do X_) - Gitter Chatroom;
  • Long questions (_I have done X and Y and it won't do Z wtf_) - Stackoverflow, using the backpack-for-laravel tag;
  • Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome _awesome_ community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

Hello @bastos71

Sorry for introducing this change without documenting it. Well, i missed it, that's why it's not documented :disappointed:

It's related to #2810

I'v fixed it with #2815

So I am going to close this.

Thanks for report :)

Thx for your answer !
My bad, I did not see the previous issue

Was this page helpful?
0 / 5 - 0 ratings