Wrong variable types in factory made models
I'm writing long overdue tests for my booking system and having a strange problem with my factory generated objects.
I'm making a student, an order for that student, an event and a booking for that student with that order for that event like so:
$order = Order::factory()->active()->for($this->student)->create();
$event = Event::factory()->workshop()->create();
$booking = Booking::factory()->for($this->student)->for($order)->for($event)->create();
On the Event model, event_type_id is an unsigned integer. Booking is a BelongsTo relation with Event.
If I var_dump the $event->event_type_id it shows as an int however if I var_dump $booking->event->event_type_id it shows as a string. If I do this in tinker with real objects fro the database, I don't have this problem.
event_type_id isn't the only integer value in my Event model that shows up as a string, so it's is obvious that I'm doing something wrong making the booking object.
Can anyone shed some light on this problem for me?
Please or to participate in this conversation.