'Room 1', 'room_rows' => 10, 'room_columns' => 10, ], [ 'room_name' => 'Room 2', 'room_rows' => 10, 'room_columns' => 10, ], [ 'room_name' => 'Room 3', 'room_rows' => 10, 'room_columns' => 10, ], ]; foreach ($rooms as $room) { $r = new \App\Models\Room(); $r->room_name = $room['room_name']; $r->room_rows = $room['room_rows']; $r->room_columns = $room['room_columns']; $r->user_id = 1; $r->cinema_id = $cinema->cinema_id; $r->save(); for ($row = 1; $row <= $r->room_rows; $row++) { for ($column = 1; $column <= $r->room_columns; $column++) { $s = new \App\Models\Seat(); $s->seat_row = $row; $s->seat_column = $column; $s->room_id = $r->room_id; $s->save(); } } } } } }