laravel-shift/blueprint

Do not use FQCN for model relationships

ajcastro opened this issue · 1 comments

Currently, the generated relationships use FQCN for the model. Usually, the models are in the same namespace like App\Models\ so I would like to have an option to remove the namespace in the model.

Current Behavior:

class User extends Model
{
    public function company()
    {
        return $this->belongsTo(\App\Models\Company::class);
    }
}

Suggested:

class User extends Model
{
    public function company()
    {
        return $this->belongsTo(Company::class);
    }
}

We should have the namespace for the current model, so determining a prefix match against related models should be straightforward. However, there's always a tricky part.

I'll tag this as an enhancement. Probably won't get to it for a while though. So feel free to open a PR. 👍