Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in the SlotRoom filter #72

Open
wolfrednicolas opened this issue May 6, 2021 · 0 comments
Open

Bug in the SlotRoom filter #72

wolfrednicolas opened this issue May 6, 2021 · 0 comments

Comments

@wolfrednicolas
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant