GithubHelp home page GithubHelp logo

sparclex / nova-creatable-belongs-to Goto Github PK

View Code? Open in Web Editor NEW
15.0 15.0 12.0 74 KB

BelongsTo Field which allows to choose or create a resource

License: MIT License

Vue 67.10% JavaScript 3.03% PHP 29.88%

nova-creatable-belongs-to's People

Contributors

sparclex avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

nova-creatable-belongs-to's Issues

Couldn't install package when Nova was installed via .zip file

I had the Nova package installed via .zip file and could not install this package.
Reason i presume was that this package requires a ^1.2 version of Nova and the
.zip install sets the nova version to "*".

Once i undid the .zip install, and followed docs on an installation via composer (with the
needed changes in composer.json) i was able to install this package.

Support for nullable()

Currently if relation is nullable and no selection is made, a model (with null name) will still be created when the resource is saved.

The second argument should be Nova resource and not the Model.

public function fields(Request $request)
{
    return [
        ID::make()->sortable(),
        CreatableBelongsTo::make('ProductType', 'productType', 'App\Nova\ProductType', 'name')
            ->prepopulate()
    ];
}

The documentation should be updated:

App\ProductType -> App\Nova\ProductType

Error if Nova Resource has custom title

Steps to reproduce:

In Nova Resource, set a custom title:

public function title()
{
       return $this->name . (empty($this->country_code) ? '' : " ({$this->country_code})");
}

When Edit an item, I get this error:

invalid input syntax for integer: "<here comes the NAME of the resource>" 
(SQL: select * from "associations" where "associations"."id" = <here comes the NAME of the resource> limit 1)

How do we handle other fields?

What happens if I want to create a "city" but I need to pass a state value to create the city?

Right now I'm using this package...

https://novapackages.com/packages/dillingham/nova-ajax-select

...to show a list of cities based on the state they select. If they don't find the city they're looking for, it would be great to create it but I don't think I can with your package without sending some additional required data to finish the job. Any help would be appreciated.

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.