rinvex / laravel-bookings

⚠️ [ABANDONED] Rinvex Bookable is a generic resource booking system for Laravel, with the required tools to run your SAAS like services efficiently. It's simple architecture, accompanied by powerful underlying to afford solid platform for your business.
MIT License
457 stars 143 forks source link

Endless redirection on Booking update #35

Closed ShapesGraphicStudio closed 3 years ago

ShapesGraphicStudio commented 4 years ago

Hello,

I'm trying tu update my Booking object extended from BookableBooking.

Booking::create(...); works fine.

Retrieving the booking in database $booking = Booking::find($booking_id); works fine.

But after that when I try to update

$booking->update([
    'total_paid' => $total_paid
]);

or save

$booking->total_paid = $total_paid;
$booking->save();

I get an endless loop.

DB::table('bookable_bookings')->where('id', $booking_id)->update(['total_paid' => $total_paid]); works fine but is kinda ugly...

Any idea on what could be going on there or how to fix this please ?

ShapesGraphicStudio commented 4 years ago

Looks like I was really struggling with the options column validation as I have been from the start. Even if options is set to nullable in model, the save() / update() seems to expect an array and will not go further. Overriding validation seems to do the trick.

I'm also struggling with the Schemaless part on remote server as I'm working wit an old version of mysql.

Migrations have a nice

protected function jsonable() {
...
}

to deal with lower mysql versions, but spatie/laravel-schemaless-attributes "... package requires a database with support for json columns like MySQL 5.7 or higher.", so it conflicts.

mcsystemen commented 4 years ago

Hi @ShapesGraphicStudio,

It seems I'm having the same problem with the redirects. When I try to create a booking my browser page keep loading and loading. After a while it gives me the ERR_TOO_MANY_REDIRECTS error in the browser. I tried to override the validation, but I can't get it to work as I don't really know where and what to override. Could you maybe give me a code example or something to help me out?

Also besides only giving met the ERR_TOO_MANY_REDIRECTS error it gives me no further errors or some hints to look after for.

Omranic commented 3 years ago

This is most probably related to validation rules, you can check your model data you're trying to create/update, or you can simply override the model and change these validation rules to what suites you https://github.com/rinvex/laravel-bookings/blob/master/src/Models/BookableBooking.php#L71-L86