plugin icon indicating copy to clipboard operation
plugin copied to clipboard

[Feature Request]: Ide.json : Have a way for "eloquentFields" to complete fields of relation

Open Tristan-MyAnaPro opened this issue 1 year ago • 2 comments

Feature Description

Hi !

I'm not sure if this is a feature request or a bug report.

I'm using the package Eloquent Power Joins to be able to simply sort a query by a field of a relation. Without a configured ide.json, the method orderByPowerJoins() don't have any completion obviously.

With a configured ide.json like this one, I'm able to have a good completion of the fields of the current model and their relation.

{
    "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
    "completions": [
        {
            "complete": "eloquentFields",
            "options": {
                "eloquentFields": {
                    "complete": "fieldsAndRelations"
                }
            },
            "condition": [
                {
                    "methodNames": [
                        "orderByPowerJoins"
                    ]
                }
            ]
        }
    ]
}

However, it never show completion for the fields of the related model.

I tried every type of complete (fieldsAndRelations, deepRelations...) and the fields are never completed.


To clarify, here's what I'd like with a step by step exemple:

MyModel::query()->orderByPowerJoins('
                                     ^ trigger completion => show fields and relation of the current model
...
MyModel::query()->orderByPowerJoins('myRelation.
                                                ^ trigger completion => show **fields** and relation of the related model

Is there a way to accomplish this with the current complete types or does it need a new completion type like "complete": "deepFieldsAndRelations" ?

Thank you for you time and your amazing work! 😸

Tristan-MyAnaPro avatar Sep 27 '24 09:09 Tristan-MyAnaPro