Closed GoatFreezy closed 2 years ago
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:
backpack-for-laravel
tag;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 @GoatFreezy . I think there migth be some confusion here. You are showing me a field
, but the error you report is in columns
, so you should have some $this->crud->addColumn()
statement ?
Thanks
Hello @pxpm. I've tried it already and it give me the exact same error as if it doesnt change anything. I've even tried to delete that part of the code and same errors happends. It seems that something break in the upgrade process tho i've read the upgrade guides and can't find anything related to my issue
Actually with only my fields defined for the List Operation the search bar doenst work.
protected function setupListOperation()
{
CRUD::column('name');
CRUD::column('serie_id');
CRUD::column('season_id');
CRUD::column('number');
CRUD::column('cover');
CRUD::column('check');
CRUD::column('path_fr');
CRUD::column('path_jap');
CRUD::column('duration');
}
@GoatFreezy what are you trying to search ? What does not work ? You talk filters, columns etc and I am a bit lost here.
Some columns need you to do your own searchLogic
https://backpackforlaravel.com/docs/5.x/crud-columns#custom-search-logic-for-columns is that the problem ?
Hello! I'm getting the same error only for one of my models. Columns: When I try to type smth in the 'search' field:
Model code:
class Vessel extends Model
{
use \Backpack\CRUD\app\Models\Traits\CrudTrait;
use HasFactory;
use SoftDeletes;
use Notifiable;
protected $keyType = 'string';
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'company_id'
];
/**
* The event map for the model.
*
* @var array
*/
protected $dispatchesEvents = [
'created' => VesselCreated::class,
];
public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Company::class, 'company_id', 'id');
}
}
I'm getting this error when I type ANYTHING into the search field.
UPD: when I commented definition of column 'company_id
' (uuid) the error didn't appear again. In the screenshot you can see my DB structure - column 'company_id
' surely exists.
@pxpm Got the exacte same error as @rommeA described. For me the error came after an upgrade of version and nothing in the code changed. i actually have only the definition on my columns in my controllers et nothing special. Im trying to filter on my relation ship via the search field in a list, do anything changer within the latest version ?
@rommeA After commenting you fields you still are being able to filter on it ?
@GoatFreezy I'm not using any filters (I didn't purchase a PRO version yet).
Anyways, I found a solution. Rename your columns and remove the '_id
' part.
In my case I changed
CRUD::column('company_id')
to
CRUD::column('company')
After that change everything works fine.
@GoatFreezy Thanks it worked for me change service_id by service.
I don't understand why this happens
@Nemachtilli @rommeA
Thanks for getting back here. I think I may have some idea where the error happens now I will have a look at it right way.
company
and company_id
in your cases should return exactly the same attributes from the relationship guessing process but somehow for you guys is not working properly.
I will investigate and get back to you guys. Also what you can do is defining 'attribute' => 'some_attribute_from_model_you_want_to_show_user'
Cheers
Bug report
What I did
This was working in Laravel 7 and backpack 4 after the upgrade this error apear when using basic filters As i debugged i see that "attribute" isnt present in applySearchLogicForColumn function line 85
The field in my controller is defined as following
Is it a bug in the latest version of Backpack?
Yes
Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is: