Skip to content

Relationship Names, NULLS and Date Formats #867

@arjasco

Description

@arjasco
  • Laravel Version: 5.7.9
  • Nova Version: 1.1.4
  • PHP Version: 7.2.3

Description:

I sent a support email over a week ago but had no reply so checking if anyone can help here or knows a workaround.

There is a couple of bugs that i have come across which would be great to get sorted. These are inconsistencies i can live with as a developer but nova is going to be extremely useful for internal staff to manage the data for a bespoke customer front-facing build. These inconsistencies will be confusing to these non developers.

  1. NULL relationships are possible and they do work if you just hit save without selecting an item from a relationship dropdown. However if a selection is made there is no way to revert back to a "None" option. Could this be a configuration option? something like ->nullable('None Label') on the field type?

  2. Changing relationship labels only reflects on index and details screens. .eg a User relationship might exist but in business logic it is something completely different.. "Booked By", "Added By", "Sales Person" etc. Which would represent a user. Here I have a Organisation which can have a Parent Organisation (nullable too, which relates back to point 1).

labels

  1. Setting a date format only reflects on index and details screen. This is confusing, especially those from countries that don't use the Y-M-D format. While building the form elements i genuinely thought the ->format() method was doing nothing till I noticed it only applies on the index/details screens.

date-format

Steps To Reproduce:

Add a relationship field to a Resource (in this case BelongsTo) with a different name by setting the additional attributes in this case the underlying resource is Organisation

BelongsTo::make('Parent Organisation', 'parent', self::class),

Organisation model parent relationship:

public function parent()
{
    return $this->belongsTo(Organisation::class, 'parent_id');
}

See that name only reflects on index/details and the dropdown field itself, also see no option to revert back to a nullable state.

Add a date field with a custom moment.js format

Date::make('Date')->format('DD/MMM/YYYY')->sortable(),

See that format only reflects on index/details

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions