mtolhuys / laravel-schematics

A Laravel package making a diagram of your models, relations and the ability to build them with it
MIT License
1.49k stars 133 forks source link

Support custom pivot models #23

Open SlyDave opened 4 years ago

SlyDave commented 4 years ago

Custom Pivot models are being included as standard models

image

(likely because they ultimately extend Model::class)

Relations that actually use these Custom model classes aren't noted as such image

The above is an example of

    public function vessels(): BelongsToMany
    {
        return $this->belongsToMany(Vessel::class, 'users_vessels')->using(UserVesselPivot::class);
    }

I think if a class is of Pivot::class it can be ignored for layout. But as the Pivot class has its own fillable etc for use with withPivot() it could also be creatable via this package when defining relations - maybe an "Add Custom Pivot Class" option then provide the same model creation interface that already exists.

dedobbin commented 4 years ago

I'm giving it a shot to implement this