Skip to content
Discussion options

You must be logged in to vote

To address your issue with searching by the belongsTo relationship in the list operation, you can use the searchLogic attribute to customize the search behavior for the "Member" column. This allows you to define how Backpack should search for the related User's name.

Here's how you can modify your setupListOperation() method to enable searching by member name:

protected function setupListOperation()
{
    CRUD::column([
        'label' => 'Member',
        'name' => 'userId',
        'entity' => 'payer',
        'attribute' => 'name',
        'model' => 'App/Models/User',
        'searchLogic' => function ($query, $column, $searchTerm) {
            $query->orWhereHas('payer', function ($q) 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by prescriptionlifeline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant