Git Product home page Git Product logo

nova-polymorphic-field's People

Contributors

jasonlav avatar jeffreydevreede avatar m2de avatar mbardelmeijer avatar michielkempen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nova-polymorphic-field's Issues

Bug: Does not show resolved display values

I ran into this issue when using a Select within the Polymorphic fields. On the display screen this would show the key value, even when using the displayUsingLabels method.

Invalid display valud

Use nova resource for fields

Any chance the fields could be automatically detected from the resource? like morphTo

MorphTo::make('Commentable')->types([
    \App\Nova\Post::class,
    \App\Nova\Video::class,
])

rules validation not work on fileds ?

PolymorphicField::make('Type')
                ->type('Video', \App\Video::class, [
                    Text::make('Url')->rules(['between:1, 50']),
                    Text::make('Score')->rules(['numeric', 'min:1']),
                ]),

maybe input form that dynamic generated caused some problem.

Is this a bug ?

Nova 4 support

Would be great to see Laravel Nova 4 support in this package. The field currently seems to be hidden in the interface from 4.0 and up.

How about a readOnlyTypeWhenUpdating() option?

PolymorphicField::make('Type')
                ->type('Video', \App\Video::class, [
                    Text::make('Url'),
                ])
                ->type('Article', \App\Article::class, [
                    Image::make('Image'),
                    Textarea::make('Text'),
                ])
                ->readOnlyTypeWhenUpdating(),
            ...

In addition to hideTypeWhenUpdating(), how about adding a readOnlyTypeWhenUpdating() option, which show the field in read-only mode?

rules('required') is ignored

When saving a PolymorphicField::make('Type') with a Text::make('Client')->rules('required') field, the rules('required') is ignored...

Error: Too few arguments to function Laravel\Nova\Resource::__construct(), 0 passed

Hi.

I try your package, but get an Error:
Too few arguments to function Laravel\Nova\Resource::__construct(), 0 passed in /Users/lars/Entwicklung/_research/Laravel/polymorph/vendor/michielkempen/nova-polymorphic-field/src/PolymorphicField.php on line 87 and exactly 1 expected

I create a new Laravel Project, with the three models - but only ::make in the Nova\NewsPost->fields()
The PolymorphicField and HasPolymorphicFields are also use by this Nova-Ressource. Have I use it for the both models Article and Video also? And have I add the fields to this models, also?

image

Change labels text

I have

PolymorphicField::make('Reserva', 'reservable', Reservation::class)
                ->type('Flight', \App\Flight::class, [
                    Date::make('Fecha', 'date'),
                    Text::make('Tipo', 'type'),
                    Number::make('Asientos', 'seats'),
                ])
                ->type('Tour', \App\Tour::class, [
                    Date::make('Fecha', 'date'),
                ])
                ->hideTypeWhenUpdating(),

And I'm getting this select:

Screen Shot 2020-09-01 at 15 41 13

But how can I change the text inside the select?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.