Skip to content
Discussion options

You must be logged in to vote

Try building nested query . Something similar to this:

    $this->crud->addClause(function ($query) {
        $query->where(function ($query) {
            $query->whereNotIn('order_status', [1, 2]) // whereNotIn condition
                  ->whereIn('id', []); // this will always return false, effectively `0 = 1`
        })
        ->orWhere('created_by', backpack_user()->id) // show orders created by me
        ->orWhere('customer_id', backpack_user()->id_company) // show orders that belong to my company
        ->orWhere(function ($query) {
            $query->where('created_by_company', backpack_user()->id_company) // show orders created by my company
        });
    });

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mariovillani
Comment options

@mariovillani
Comment options

Answer selected by mariovillani
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants