Giter Club home page Giter Club logo

nova-child-select's People

Contributors

alvinhu avatar persteinhorst avatar

Stargazers

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

Watchers

 avatar  avatar

nova-child-select's Issues

cant use for cycle dependency

CREATE TABLE category (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
title VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_ci',
parent_category_id INT(10) UNSIGNED NULL DEFAULT NULL,
enabled TINYINT(1) NOT NULL DEFAULT '1',
title_en VARCHAR(255) NOT NULL COLLATE 'utf8mb4_unicode_ci',
PRIMARY KEY (id) USING BTREE,
INDEX category_parent_category_id_foreign (parent_category_id) USING BTREE,
CONSTRAINT category_parent_category_id_foreign FOREIGN KEY (parent_category_id) REFERENCES inar_local_refactored.category (id) ON UPDATE RESTRICT ON DELETE RESTRICT
)

        Select::make('Category')
            ->options(\App\Category::all()->mapWithKeys(function ($category) {
                return [$category->id => $category->title];
            }))
            ->rules('required'),

        ChildSelect::make('Category')
            ->parent('id')
            ->options(function ($value) {
                \App\Category::whereParentCategoryId($value)->get()->mapWithKeys(function ($category) {
                    return [$category->id => $category->title];
                });
            })
            ->rules('required'),

what I'm doing wrong? you example in lib doesn not show initial DB structure.

How to use this package in BelongsToMany Relation

How to Use this package in BelongsToMany Relation, I am currently doing this

BelongsToMany::make('Periods') ->fields(function () { return [ ChildSelect::make('Start Date', 'from_date') ->options(function ($value) { Period::where('id', $value)->get()->mapWithKeys(function ($period) { return [$period->id => $period->from_date]; }); }), ]; }),

But This does not work

display select options in groups:

If` I return this as select options from the resources

[`
    'MS' => ['label' => 'Small', 'group' => 'Men Sizes'],
    'MM' => ['label' => 'Medium', 'group' => 'Men Sizes'],
    'WS' => ['label' => 'Small', 'group' => 'Women Sizes'],
    'WM' => ['label' => 'Medium', 'group' => 'Women Sizes'],
]

group will be ignored and it is rendered as normal select without the option group.

Trouble using other Field than Nova Select Field

I am having an issue using a different nova package other than Select as the main parent. . Is there any way we can use another package? is this possible and what is the current functionality to watching the Standard Select Field?

N+1 Query

public function fields()
{
        return [
            Select::make('Provider', 'provider')
                ->options((\App\Person::all())
                ->rules('required')
 }

\App\Person::all() is causing N+1 Query, How do I prevent it ?

Queries get executed on index despite ->onlyOnForms()

Hi,

Excellent package, but is there any way to prevent this? For every row on the index these queries are run, thus having a negative impact on performance (haven't measured though).

      Select::make('Country')
               ->options(\App\Models\Country::all()->mapWithKeys(function ($country) {
                   return [$country->id => $country->name];
               }))
               ->onlyOnForms()
               ->rules('required', 'integer'),

           ChildSelect::make('City')
               ->parent('country')
               ->options(function ($value) {
                   \App\Models\City::whereCountryId($value)->get()->mapWithKeys(function ($city) {
                       return [$city->id => $city->name];
                   });
               })
               ->onlyOnForms()
               ->rules('required', 'integer'),

options request 404

      Select::make('Country')
               ->options(\App\Models\Country::all()->mapWithKeys(function ($country) {
                   return [$country->id => $country->name];
               }))
               ->onlyOnForms()
               ->rules('required', 'integer'),

           ChildSelect::make('City')
               ->parent('country')
               ->options(function ($value) {
                   \App\Models\City::whereCountryId($value)->get()->mapWithKeys(function ($city) {
                       return [$city->id => $city->name];
                   });
               })
               ->onlyOnForms()
               ->rules('required', 'integer'),

nova version: 2.0.1

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.