Skip to content

Bug in the SlotRoom filter #72

@wolfrednicolas

Description

@wolfrednicolas

There is a filter called SlotRoom one of its method is options

public function options(Request $request)
{
    /** @var Model $models */
    $roomModel = app('room');

    return $roomModel->pluck('id', 'name')->all();
}

If I call this filter, from the class Booking in the Booking package... got 500 error

image

the problem here is the name because the current table rooms has no column called name, currently is build it

public function getNameAttribute()
{
    // Check if the location has multiple rooms with same theme. Will need to edit later for accurate count.
    if (self::where('location_id', $this->location_id)->where('escaperoom_theme_id', $this->escaperoom_theme_id)->count() > 1) {
        return "{$this->location->abbreviation} {$this->theme->name} #{$this->id}";
    }

    // If only room at the location with the theme, return theme title
    return "{$this->location->abbreviation} {$this->theme->name}";
}

Two possible solutions here to solved this issue:

1 - add a new migration adding the column name add fill its value with the logic made in getNameAttribute
2 - change the logic in the option method, (Complex)

In addition, I think this filter should be moving to the escape-room package

@joshtorres @drewroberts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions