I have the following table in my mysql database with events with start and end TIME datatype:
start_time end_time day
08:00:00 16:00:00 1
08:00:00 16:00:00 1
08:00:00 16:00:00 4
08:00:00 16:00:00 5
I want to create a multidimensional array with this where each day have it's start_time and end_time in an array, like this;
array:3 [
1 => array:2 [
0 => array:2 [
0 => "08:00"
1 => "16:00"
]
1 => array:2 [
0 => "08:00"
1 => "16:00"
]
]
4 => array:1 [
0 => array:2 [
0 => "08:00"
1 => "16:00"
]
]
5 => array:1 [
0 => array:2 [
0 => "08:00"
1 => "16:00"
]
]
]
I have a variable with all events in which i could foreach to go through.
Is this doable or do I need to use pivot tables to keep these two values seperated?
Thanks!