michielkempen / nova-polymorphic-field Goto Github PK
View Code? Open in Web Editor NEWA Laravel Nova field that allows you to create a collection of polymorphic resources.
License: MIT License
A Laravel Nova field that allows you to create a collection of polymorphic resources.
License: MIT License
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,
])
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 ?
hideWhenCreating
methods on the fields are currently not supported for fields under a polymorphic field.
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.
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?
When saving a PolymorphicField::make('Type')
with a Text::make('Client')->rules('required')
field, the rules('required')
is ignored...
Currently when adding a BelongsTo relationship field the resource will not work at all. PR #13 opening to resolve this.
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?
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:
But how can I change the text inside the select?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.